Terug naar hoofdinhoud

How to setup SQL server in Azure

Step 1:


- Format F: and G: with the NTFS and Allocation unit size : 64 kilobytes
- Create the following directoies:

F:\MSSQL\Data
G:\MSSQL\Log
G:\MSSQL\ErrorLog
H:\MSSQL\Backup

Give user: NT Service\MSSQLSERVER full access to the
F:\MSSQL
G:\MSSQL
H:\MSSQL

Please note when removing Everyone & Users from the main drive to add the 'NT Service\MSSQLSERVER' account on the top level with read rights

Step 2:

go to the SQL Server Configuration Manager and there stop the SQL Server(MSSQLSERVER) service
Change in SQL Server(MSSQLSERVER) (Right click --> Properties --> Startup Parameters) to the following:

-dF:\MSSQL\Data\master.mdf
-eG:\MSSQL\ErrorLog\ERRORLOG
-lG:\MSSQL\Log\mastlog.ldf

Now move the Master.mdf and masterlog.ldf from C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA to:
*Please note that the MSSQL12.MSSQLSERVER is the version of the SQL in older versions this can change

F:\MSSQL\Data\master.mdf
G:\MSSQL\Log\mastlog.ldf

When done start the SQL server

Step 3:

Open the MSSQL studio and run the following queries:

USE master;
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdev, FILENAME = 'F:\MSSQL\Data\tempdb.mdf');
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = templog, FILENAME = 'G:\MSSQL\Log\templog.ldf');
GO
ALTER DATABASE model
MODIFY FILE (NAME = modeldev, FILENAME = 'F:\MSSQL\Data\model.mdf');
GO
ALTER DATABASE model
MODIFY FILE (NAME = modellog, FILENAME = 'G:\MSSQL\Log\modellog.ldf');
GO
ALTER DATABASE msdb
MODIFY FILE (NAME = MSDBData, FILENAME = 'F:\MSSQL\Data\MSDBData.mdf');
GO
ALTER DATABASE msdb
MODIFY FILE (NAME = MSDBLog, FILENAME = 'G:\MSSQL\Log\MSDBLog.ldf');
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE'
                , N'Software\Microsoft\MSSQLServer\MSSQLServer'
                , N'DefaultData'
                , REG_SZ
                , N'F:\MSSQL\Data'
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE'
                , N'Software\Microsoft\MSSQLServer\MSSQLServer'
                , N'DefaultLog'
                , REG_SZ
                , N'G:\MSSQL\Log'
GO


Stop the SQL service (SQL Server (MSSQLSERVER))

Move the files form C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA to:
F:\MSSQL\Data\tempdb.mdf
F:\MSSQL\Data\model.mdf
F:\MSSQL\Data\MSDBData.mdf

G:\MSSQL\Log\templog.ldf
G:\MSSQL\Log\modellog.ldf
G:\MSSQL\Log\MSDBLog.ldf

Start the SQL Service (SQL Server (MSSQLSERVER))

Check the Databases --> System Databases if the all have started, when all is OK. remove the databases and databaselogs from :
C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA

Step 4:

Right click on the DB instance name and select properties.
- On memory change the value to 80% of the system memory
- On Database settings change the Data / Log & Backup path:
Backup: H:\MSSQL\Backup

Step 5:

- Create Backup plan
- Create a daily maintenance plan