about_dbaship.help.txt
|
TOPIC
about_dbaship SYNOPSIS Basic logshipping Configuration. LONG DESCRIPTION A basic logshipping configuration tool using just a few parameters. EXAMPLES USE CASE Example -------------------------------------------------------------- Database db1, db2 and db3 are located in SQL-Primary server. We need to create logshipping in SQL-Secondary Server and a monitor in SQL-Monitor server. All Primary database files are currently in drive C: For SQL-Secondary two drives have been provided to separate mdfs and ldfs D: for mdfs and E: for ldfs A new drive, S: has been provided in Primary and Secondary servers for logshipping files CONVENTIONS ------------------------------------------------------------------ (1) Run in Primary server (2) Run in Secondary server (3) Run in Monitor server (*) Server Administrator (Box) required All other commands require sysadmin account INSTALL dbaShip module -------------------------------------------------------- (123) install-module dbaship import-module dbaship get-module dbaship PARAMETERS -------------------------------------------------------------------- (123) $credential = get-credential sysadmin_acount $params = @{ credential = $credential primary_server = 'SQL-Primary' primary_database = 'db1' primary_root = 'S:\MSSQL\shipping' secondary_server = 'SQL-SECONDARY' secondary_root = 'S:\MSSQL\shipping' } $files = @{ data_root = "D:\MSSQL" log_root = "E:\MSSQL" } $databases = @{ databases = "db1", "db2", "db3" } test-shipConfig @params @files @databases Parameters are configured as per use-case. test-shipConfig will help you verify all parameters are ok PREPARE FOLDERS --------------------------------------------------------------- (12*) add-shipFolders @params @databases this will create this folder structure in primary and secondary servers: S:\MSSQL '-- shipping |-- db1 |-- db2 |-- db3 '-- dbaship In secondary server (only) this additional folders will be created D:\MSSQL '-- DATA E:\MSSQL '-- Log After creating the folders in Primary server, create the share from S:\MSSQL\shipping as \\SQL-PRIMARY\shipping Provide both servers agent accounts full access to to this share PRIMARY SERVER CONFIGURATION -------------------------------------------------- (1) install-shipPrimary @params backup-shipPrimary @params get-shipConfig @params Install command will configure db1 database in primary server for logshipping. It will also create the backup job LSBackup_db1 and its backup schedule. backup command Will create a backup for db1 in the share folder, that will be restored in the secondary server, later. The get-shipConfig command will provide you config information as you go. SECONDARY SERVER CONFIGURATION ------------------------------------------------ (2*) copy-shipBackup @params (2) restore-shipSecondary @params install-shipSecondary @params get-shipConfig @params Copy command will copy backup from share folder into corresponding shipping folder where Restore command will bring the database in NORECOVERY mode. Install comand will config db1 as Secondary and bring it in STANDBY mode. It will also create LSCopy_SQL-PRIMARY_db1 and LSRestore_SQL-PRIMARY_db1 jobs and their schedules. At this point your db1 database is logshipped and should be up and running. If you want to install a monitor continue with next step To continue logshipping db2, change $params.primary_database = db2 and start from PRIMARY SERVER CONFIGURATION. Repeat for db3. MONITORING (Optional) --------------------------------------------------------- (3) install-shipMonitorPrimary @params -monitor_server SQL-MONITOR install-shipMonitorSecondary @params -monitor_server SQL-MONITOR get-shipConfig @params Install commands will set primary and secondary server for third server monitoring. It will also create linked servers in primary and secondary servers The LSAlert_SQL-MONITOR job and alerts will be created in SQL-MONITOR server Dont forget to add the operators to the alert to receive the messages You can now use the Transaction Log Shipping Status Report in SSMS from the Monitor server. ================================== ADVANCED =================================== REMOVING CONFIGURATION -------------------------------------------------------- to remove db2 logshipping configuration: $params.primary_database = db2 remove-shipConfig @params Remove commnad will remove all configuration and Jobs associated with the database log shipping. TROUBLESHOOTING --------------------------------------------------------------- Must errors are asociated with the lack of permission to the servers agent account. See advanced configuration below for more details. SEE ALSO Text-only references for further reading. Hyperlinks can't work in the PowerShell console. |