tdp sql v63

44
TSM 6.3: Install Data Protection for SQL Server 1) Double click SetupFCM.exe in the installation package folder, then just follow the wizard.

Transcript of tdp sql v63

Page 1: tdp sql v63

TSM 6.3: Install Data Protection for SQL Server

1) Double click SetupFCM.exe in the installation package folder, then just follow the wizard.

Page 9: tdp sql v63

2) Login into TSM_Sandbox to create the SQL domain policy and register the SQL node.

define domain SQLdefine policy SQL NORMAL desc=”Normal SQL backup policy”define mgmt SQL NORMAL DAILYassign defmgmtclass SQL NORMAL DAILYdefine

Page 10: tdp sql v63

copygroup SQL NORMAL DAILY type=backup dest=DEDUPPOOL verexists=7 retextra=30 verd=7 reto=30define copygroup SQL NORMAL DAILY type=archive dest=DEDUPPOOL retver=30validate policy SQL NORMALactivate policy SQL NORMAL

Register TSM_Client01. In my example, I have already registered it the previous tests.

register node TSM_Client01 <password>update node TSM_Client01 backdelete=yes forcep=yes

Register TSM_Client01_SQL as SQL backup proxy node.

register node TSM_Client01_SQL <password> domain=SQLupdate node TSM_Client01_SQL backdelete=yes forcep=yesgrant proxynode target=TSM_Client01_SQL agent=TSM_Client01

3) Configure Data Protection for SQL Server on TSM_Client01

Page 16: tdp sql v63

Query the tdp, tsm and sql to confirm everything works fine. Ensure you login account with the admin permission of the server and SQL.

4) Restart TSM_Client01 to finish the installation.

Page 17: tdp sql v63

TSM 6.3: Backup SQL Database

There are two types of backup method in Tivoli Data Protection for SQL Sever: VSS and Legacy. VSS backup only supports Full, Legacy backup supports Full, Differential and Log. VSS backup supports instant restore (volume level), fast restore (file level), but it only can restore the data to the server with same name. Legacy backup does not have much limits, and it is the default backup method in the tdpsqlc command.

Example 1: Use DP For SQL Management Console

1) Login into TSM_Client01 and launch DP For SQL Management Console (it requires flash copy manager license).

2) I will start with flash copy manager. Right click the SQL server and choose properties

3) Configure the VSS Policy Binding based on your needs. In my example, I make TSM as the only backup destination.

Page 18: tdp sql v63

4) Configure a SQL login account with sysadmin right in SQL server.

Page 20: tdp sql v63

6) After the full backup completed. The Log size is almost same, this is because the VSS Full backup does truncate the logs. To truncate log, a log backup has to be done.

7) Any DB with ‘Truncate log on checkpoint’ attribute means the log only can be truncated by SQL server itself. It is called simple recovery mode. Open the SQL management studio, and run the following SQL query against the System Database to find it out.

SELECT name, recovery_model_descFROM sys.databases

Page 21: tdp sql v63

8) Change the recovery mode to Full of the database that I am going to backup the log. Right click the DB and choose properties.

Page 22: tdp sql v63

9) Click ‘Show Backup Options’ then change the value to ‘True’ in Truncate field.

Page 23: tdp sql v63

10) Right click the database and choose Legacy Full backup. The log backup only can be done after a Legacy full or differential backup.

11) After the full backup completed, right click the database and choose Legacy and Log backup.

Page 24: tdp sql v63

Example 2: Use tdpsqlc

1) Login into TSM_Client01 and run C:\Program Files\Tivoli\TSM\TDPSql\tdpsqlc.exe

2) Choose the database and run a Legacy Full backup

Page 26: tdp sql v63

3) Choose the database and run a Legacy Log backup.

Page 27: tdp sql v63

Example 3: Schedule SQL Full Backup

1) Login into TSM_Client01 to install client scheduler (you still need to do so if there is an existing one for the normal BA client)

2) Follow the steps described before, and name it TSM SQL Client Scheduler

the dsm.opt file under C:\Program Files\Tivoli\TSM\TDPSql should be like this:

NODename TSM_Client01_SQLPASSWORDAccess generateTCPServeraddress TSM_SandboxTCPPort 1500HTTPport 1581SCHEDMODE PROMPTEDMANAGEDSERVICES WEBCLIENT SCHEDULE

3) Create a batch file named sqlfull.cmd under C:\Program Files\Tivoli\TSM\TDPSql\ (there is a sample file sqlfull.smp in the same foder). I want a full backup of the database followed by a log backup every day.

@ECHO OFFrem ==================================================================rem sqlfull.smp sample command fileremrem Sample command file containing commands to do a scheduled fullrem backup of all SQL databases to an IBM Tivoli

Page 28: tdp sql v63

Storage Managerrem server.remrem This file is meant to be executed by the IBM Tivoli Storage rem Manager central scheduler in response to a defined schedule on rem the IBM Tivoli Storage Manager server.remrem ==================================================================

rem ==================================================================rem Replace “C:” with the drive where Data Protection for SQLrem is installed. Update the directory to match the installationrem directory that you chose when you installed the product.rem ==================================================================

set sql_dir=C:\Progra~1\Tivoli\TSM\TDPSql

C:

cd %sql_dir%

rem ==================================================================rem The two lines below put a date/time stamp in a log file for you.rem Note: You can change “sqlsched.log” to whatever you prefer in rem lines below.rem ==================================================================

date /t < NUL >> %sql_dir%\sqlsched.logtime /t < NUL >> %sql_dir%\sqlsched.log

rem ==================================================================rem Now call the command-line interface to do the backup:remrem Replace “srvrname” with the name of the options file name yourem plan to use.remrem If SQL authentication is being used and the SQL login settings haverem not been stored via the GUI, you must also specify the /sqluser and rem /sqlpassword options on the command below.remrem In this example, we use the ‘*’ to back up all of the databasesrem on the SQL server. Note that database ‘tempdb’ will notrem be backed up. rem rem Note: You can change “sqlsched.log” and “sqlfull.log” torem whatever you prefer.rem ==================================================================

%sql_dir%\tdpsqlc backup * full /tsmoptfile=%sql_dir%\dsm.opt /logfile=%sql_dir%\sqlfull.log >> %sql_dir%\sqlsched.log%sql_dir%\tdpsqlc backup * log /tsmoptfile=%sql_dir%\dsm.opt /logfile=%sql_dir%\sqlfull.log >> %sql_dir%\sqlsched.log

set RC=%ERRORLEVEL%echo ——————— >> %sql_dir%\sqlsched.logecho

Page 29: tdp sql v63

Return code was %RC% >> %sql_dir%\sqlsched.logecho ===================== >> %sql_dir%\sqlsched.logexit %RC%

4) Double click the batch file to run a test. Check the sqlsched.log file after it completed.

Thu 14/06/2012 11:56 AMANS0102W Unable to open the message repository tdpsena.txt. The American English repository will be used instead.

IBM Tivoli Storage Manager for Databases:Data Protection for Microsoft SQL ServerVersion 6, Release 3, Level 0.0(C) Copyright IBM Corporation 1997, 2011. All rights reserved.

ACO5057I The C:\Progra~1\Tivoli\TSM\TDPSql\sqlfull.log log file was pruned successfully.

Connecting to SQL Server, please wait…

Starting SQL database backup…

Connecting to TSM Server as node ‘TSM_CLIENT01_SQL’…

Beginning full backup for database LcsCDR, 1 of 7.Full: 3 Read: 6291456 Written: 0 Rate: 0.00 Kb/Sec Full: 0 Read: 9523968 Written: 9523968 Rate: 4,309.89 Kb/Sec

Backup of LcsCDR completed successfully.

Beginning full backup for database master, 2 of 7.Full: 0 Read: 3235584 Written: 3235584 Rate: 7,879.68 Kb/Sec

Backup of master completed successfully.

Beginning full backup for database model, 3 of 7.Full: 0 Read: 2184960 Written: 2184960 Rate: 2,243.69 Kb/Sec

Backup of model completed successfully.

Beginning full backup for database msdb, 4 of 7.Full: 3 Read: 10485760 Written: 0 Rate: 0.00 Kb/Sec Full: 0 Read: 12680960 Written: 12680960 Rate: 7,246.20 Kb/Sec

Backup of msdb completed successfully.

Page 30: tdp sql v63

Beginning full backup for database QoEMetrics, 5 of 7.Full: 0 Read: 5335808 Written: 5335808 Rate: 6,892.53 Kb/Sec

Backup of QoEMetrics completed successfully.

Beginning full backup for database ReportServer, 6 of 7.Full: 3 Read: 11534336 Written: 0 Rate: 0.00 Kb/Sec Full: 3 Read: 20027904 Written: 0 Rate: 0.00 Kb/Sec Full: 0 Read: 20030208 Written: 20030208 Rate: 8,851.02 Kb/Sec

Backup of ReportServer completed successfully.

Beginning full backup for database ReportServerTempDB, 7 of 7.Full: 0 Read: 2190080 Written: 2190080 Rate: 3,839.77 Kb/Sec

Backup of ReportServerTempDB completed successfully.

Inactivating log backup LcsCDR\201206131534450001628Inactivating log backup QoEMetrics\201206131629490000AA4

Total SQL backups selected: 7Total SQL backups attempted: 7Total SQL backups completed: 7Total SQL backups excluded: 0Total SQL backups inactivated: 2Total SQL backups deduplicated: 0

Throughput rate: 6,156.55 Kb/SecTotal bytes inspected: 55,181,568Total bytes transferred: 55,181,568Total LanFree bytes transferred: 0Total bytes before deduplication: 0Total bytes after deduplication: 0Data compressed by: 0%Deduplication reduction: 0.00%Total data reduction ratio: 0.00%Elapsed processing time: 8.75 Secs

ANS0102W Unable to open the message repository tdpsena.txt. The American English repository will be used instead.

IBM Tivoli Storage Manager for Databases:Data Protection for Microsoft SQL ServerVersion 6, Release 3, Level 0.0(C) Copyright IBM Corporation 1997, 2011. All rights reserved.

ACO5057I The C:\Progra~1\Tivoli\TSM\TDPSql\sqlfull.log log file was pruned successfully.

Connecting to SQL Server, please wait…

Starting SQL database backup…

Page 31: tdp sql v63

Connecting to TSM Server as node ‘TSM_CLIENT01_SQL’…

Beginning log backup for database LcsCDR, 1 of 4.Full: 0 Read: 84736 Written: 84736 Rate: 57.83 Kb/Sec Full: 0 Read: 84736 Written: 84736 Rate: 52.34 Kb/Sec

Backup of LcsCDR completed successfully.

Beginning log backup for database model, 2 of 4.Full: 0 Read: 85760 Written: 85760 Rate: 98.41 Kb/Sec

Backup of model completed successfully.

Beginning log backup for database QoEMetrics, 3 of 4.Full: 0 Read: 90880 Written: 90880 Rate: 98.50 Kb/Sec

Backup of QoEMetrics completed successfully.

Beginning log backup for database ReportServer, 4 of 4.Full: 0 Read: 105216 Written: 105216 Rate: 101.53 Kb/Sec Full: 0 Read: 105216 Written: 105216 Rate: 88.43 Kb/Sec

Backup of ReportServer completed successfully.

Total SQL backups selected: 7Total SQL backups attempted: 4Total SQL backups completed: 4Total SQL backups excluded: 3Total SQL backups deduplicated: 0

Throughput rate: 79.59 Kb/SecTotal bytes inspected: 366,592Total bytes transferred: 366,592Total LanFree bytes transferred: 0Total bytes before deduplication: 0Total bytes after deduplication: 0Data compressed by: 0%Deduplication reduction: 0.00%Total data reduction ratio: 0.00%Elapsed processing time: 4.50 Secs

——————— Return code was 0 =====================

5) Login to the TSM_Sandbox to create a SQL backup schedule for this job, and associate TSM_Client01_SQL to this schedule.

def sched SQL Daily_Full desc=”SQL Daily Full Backup” action=command objects=”objects=”C:\Progra~1\Tivoli\TSM\TDPSql\sqlfull.cmd” priority=2 starttime= now duration=15 duru=minutes period=1 perunits=day dayofweek=any

Page 32: tdp sql v63

define association SQL Daily_Full TSM_Client01_SQL

6) Check the log file to confirm the job is completed successfully.

or check the event on the TSM_Sandbox by running:

q event SQL Daily_Full f=d

TSM 6.3: Restore SQL Database

Page 33: tdp sql v63

TSM SQL database restoration method is very flexible. My example is just a small taste of it.

Example 1: Restore DB with same name to the same server

1) Delete the table dbo.ChunkData from the ReportServerTempDB to simulate the scenario of data loss.

Page 34: tdp sql v63

2) Open flash copy manager on TSM_Client01 and set Replace=True in the restore option.

3) Choose the backup DB and click restore.

Page 35: tdp sql v63

4) Confirm the removed table is restored

Example 2: Restore DB with different name to the same server

1) Right click the backup DB and choose ‘Restore to Alternate Location…’

Page 36: tdp sql v63

2) Set the new name of the database to be TEST, and new location of the file is C:\Backup

Page 37: tdp sql v63

3) Confirm the new DB in SQL server

Example 3: Restore DB from TSM_Client02 to TSM_Client01

Page 38: tdp sql v63

1) Change nodename to TSM_Client02_SQL in the file C:\Program Files\Tivoli\TSM\TDPSql\dsm.opt on TSM_Client01

NODename TSM_Client02_SQL

2) Launch tdpsql.exe and click Restore Databases tab. A warning may pop up, just click OK. (or grant the proxynode on TSM_Sandbox first: grant proxynode target=TSM_Client02_SQL agent=TSM_Client01)

3) The DB on the source server will be listed now. Just choose the DB and click restore. (You can specify the new DB name in Restore Into, and new location in Relocate)

Page 40: tdp sql v63

4) Confirm the database has been restored. And change the setting that is modified in step 1) back.

Example 4: Use tdpsqlc to restore DB from a different server

1) Uncomment the password settings in the dsm.opt on TSM_Client01

*PASSWORDAccess generate

2) Run the following command to restore database named “Profile DB” from TSM_Client02 to TSM_Client01

tdpsqlc restore “Profile DB” full /tsmnode=TSM_client02_SQL /fromSQLServer=Sbox-Sql

Page 41: tdp sql v63

3) Confirm the “profile DB” has been restored, and change the password settings back.