Ads
14 August 2017
28 July 2017
Move System Databases
Here is the steps to move the system databases:
==================================
Master
- Change the physical location of the files from startup parameters once the SQL Server is offline, then copy and move the MDF and LDF to new location.
- Now rename existing files as old on previous location
-Now bring SQL Server online
MSDB
SELECT name, physical_name FROM sys.master_files WHERE database_id = DB_ID('msdb');
GO
USE master;
GO
ALTER DATABASE msdb
MODIFY FILE (NAME = MSDBData, FILENAME = 'Z:\Data\MSDBData.mdf');
GO
ALTER DATABASE msdb
MODIFY FILE (NAME = MSDBLog, FILENAME = 'Z:\Log\MSDBLog.ldf');
GO
Model
SELECT name, physical_name FROM sys.master_files WHERE database_id = DB_ID(N'model');
GO
USE master;
GO
ALTER DATABASE model
MODIFY FILE (NAME = modeldev, FILENAME = 'Z:\Data\model.mdf');
GO
ALTER DATABASE model
MODIFY FILE (NAME = modellog, FILENAME = 'Z:\SystemDBs\Log\modellog.ldf');
GO
TEMPDB
Use master
GO
SELECT name AS [LogicalName] ,physical_name AS [Location] ,state_desc AS [Status]
FROM sys.master_files WHERE database_id = DB_ID(N'tempdb');
GO
USE master;
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdev, FILENAME = 'Z:\TempDB\Data\tempdb.mdf');
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdb2, FILENAME = 'Z:\TempDB\Data\TempDB2.ndf');
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdb3, FILENAME = 'Z:\TempDB\Data\TempDB3.ndf');
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdb4, FILENAME = 'Z:\TempDB\Data\TempDB4.ndf');
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = templog, FILENAME = 'Z:\TempDB\Log\templog.ldf');
GO
Resource DB
Can I change the Resource database path? Should I?
No
Thanks to :
https://blogs.msdn.microsoft.com/vsanil/2012/11/02/resource-database-common-questions/
https://sqlandme.com/2013/07/08/sql-server-how-to-change-sql-server-errorlog-location/
==================================
Master
- Change the physical location of the files from startup parameters once the SQL Server is offline, then copy and move the MDF and LDF to new location.
- Now rename existing files as old on previous location
-Now bring SQL Server online
MSDB
SELECT name, physical_name FROM sys.master_files WHERE database_id = DB_ID('msdb');
GO
USE master;
GO
ALTER DATABASE msdb
MODIFY FILE (NAME = MSDBData, FILENAME = 'Z:\Data\MSDBData.mdf');
GO
ALTER DATABASE msdb
MODIFY FILE (NAME = MSDBLog, FILENAME = 'Z:\Log\MSDBLog.ldf');
GO
Model
SELECT name, physical_name FROM sys.master_files WHERE database_id = DB_ID(N'model');
GO
USE master;
GO
ALTER DATABASE model
MODIFY FILE (NAME = modeldev, FILENAME = 'Z:\Data\model.mdf');
GO
ALTER DATABASE model
MODIFY FILE (NAME = modellog, FILENAME = 'Z:\SystemDBs\Log\modellog.ldf');
GO
TEMPDB
Use master
GO
SELECT name AS [LogicalName] ,physical_name AS [Location] ,state_desc AS [Status]
FROM sys.master_files WHERE database_id = DB_ID(N'tempdb');
GO
USE master;
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdev, FILENAME = 'Z:\TempDB\Data\tempdb.mdf');
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdb2, FILENAME = 'Z:\TempDB\Data\TempDB2.ndf');
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdb3, FILENAME = 'Z:\TempDB\Data\TempDB3.ndf');
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdb4, FILENAME = 'Z:\TempDB\Data\TempDB4.ndf');
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = templog, FILENAME = 'Z:\TempDB\Log\templog.ldf');
GO
Resource DB
Can I change the Resource database path? Should I?
No
Thanks to :
https://blogs.msdn.microsoft.com/vsanil/2012/11/02/resource-database-common-questions/
https://sqlandme.com/2013/07/08/sql-server-how-to-change-sql-server-errorlog-location/
25 May 2017
Unable to open the physical file , operating system error 5. (Access is denied)
Solution:
1. Add permissions to the disk contain Data and Log files
2. Add service account to login with SA
3. Take DB offline
Alter database DB_NAME set offline with rollback immediate
4. Bring back the DB online
Alter database DB_NAME set online with rollback immediate
this resolves the issue, else we need to try restarting SQL Services. Worst-case we need to restore the database with latest backup.
1. Add permissions to the disk contain Data and Log files
2. Add service account to login with SA
3. Take DB offline
Alter database DB_NAME set offline with rollback immediate
4. Bring back the DB online
Alter database DB_NAME set online with rollback immediate
this resolves the issue, else we need to try restarting SQL Services. Worst-case we need to restore the database with latest backup.
18 April 2017
SQL 2016 - A severe error occurred on the current command. SQL Server Error Log / SQL Services Not coming online
A severe error occurred on the current command. The results, if any, should be discarded. (Microsoft SQL Server, Error: 0)
Solution 1: Repair SSMS tools of SQL Server 2016.
Solution 2: Repair the SQL Server Instance.
Solution 3: Create alias under SQL Server network configuration.
=======================================================================
Solution 3 will be more appropriate when we see the below error in windows event viewer along with the above mentioned error.=======================================================================
Severity: 16 Error:-1, OS: -1 [Microsoft][ODBC Driver 13
for SQL Server]SQL Server Network Interfaces: Error Locating Server/Instance
Specified [xFFFFFFFF].
Solution:
04 March 2017
Maximum Worker Thread
About Worker Thread:
When a request is received, SQL Server will try
to locate an idle thread to schedule the request. If an idle worker was not
located, new worker will be created. If all workers have been created
and none is idle, then the request is queued which will be picked up by any
worker thread from the pool of worker threads created.
The following table shows the automatically configured number of
max worker threads for various combinations of CPUs and versions of SQL Server.
CPU CORE COUNT
|
MWT- 32 BIT
|
MWT-64 BIT
|
Up-to 4 processors
|
256
|
512
|
Octa-Core 8 processors
|
288
|
576
|
16 processors
|
352
|
704
|
32 processors
|
480
|
960
|
64 processors
|
736
|
1472
|
128 processors
|
4224
|
4480
|
256 processors
|
8320
|
8576
|
-- show Max number of worker threads on the SERVER
select serverproperty('instancename') as instancename, max_workers_count as
'AllowedOn64Bit' from
sys.dm_os_sys_info
-- show number Current no of worker threads
select serverproperty('instancename') as instancename, COUNT(*) as MAXCOUNT from sys.dm_os_workers
-- show the THREADPOOL wait time
select * from sys.dm_os_wait_stats where wait_type = 'THREADPOOL'
---- most of the sessions are waiting for
LCK_M_S
select * from sys.dm_os_waiting_tasks
03 March 2017
SQL Server 2000 - the application failed to start because msvcr71.dll or msvcp71.dll was not found
Error:The application failed to start because msvcr71.dll or msvcp71.dll was not found
These files must be present on C:|Windows\System32 folder and also they should be present on SQL\Binn folder, either any software installation/upgrade /Anti virus might bombed these files.
Solution:
1. Search these files on the computer.
2. Paste them to SQL Binaries folder - C:\Pf\MS\MSSQL\Binn
3. Paste them to C:\Windows\System32 folder also
4. Bring SQL Services online
Hope it helps someone! Thanks.
These files must be present on C:|Windows\System32 folder and also they should be present on SQL\Binn folder, either any software installation/upgrade /Anti virus might bombed these files.
Solution:
1. Search these files on the computer.
2. Paste them to SQL Binaries folder - C:\Pf\MS\MSSQL\Binn
3. Paste them to C:\Windows\System32 folder also
4. Bring SQL Services online
Hope it helps someone! Thanks.
SQL Server Agent can't Connect-Comes Online - 2016
ERROR: SQLServerAgent could not be started (reason: Unable to connect to server 'WIN\Group'; SQLServerAgent cannot start).
Solution:
1. Connect to SQL Server Instance
2. Go to SQl Server Agent
3. Select -> right Click -> properties -> choose Connection
4. paste instance name as follows
servername.domain.biz\instance_name
5. Click ok
Now go to failover cluster manager and bring agent online. Issue resolved.
Solution:
1. Connect to SQL Server Instance
2. Go to SQl Server Agent
3. Select -> right Click -> properties -> choose Connection
4. paste instance name as follows
servername.domain.biz\instance_name
5. Click ok
Now go to failover cluster manager and bring agent online. Issue resolved.
Subscribe to:
Posts (Atom)
-
Find More On : - http://www.sqlserver-training.com/250-sql-queries-interview-question-answers/-#5+ SQL Queries Interview Questions ...
-
ERROR: report server remote procedure call (RPC) end point. Verify that the Report Server Windows service is running, and then retry the o...
-
http://technet.microsoft.com/en-us/library/cc731002(WS.10).aspx#BKMK_requirements How accounts are created through wizards in ...