Perform the Restore
Note: You must perform step-by-step restores from the CommCell Console.
-
Download the restore_template.xml file to the computer where you will run the command.
-
Open the restore_template.xml file, add your specific parameters, and save the file.
-
On the command line, go to Software_Installation_Directory/Base and type the command.
qoperation execute -af restore_template.xml -clientName $[client_name] -instanceName $[instance_name] -destClient/clientName $[destination_client_name] -destinationInstance/clientName $[client_name] -destinationInstance/instanceName $[destination_instance_name] -destinationServer/name $[destination_server_name] -databaseId/name $[database_name] -devices $[source_subclientId]:$[source_dbId]:$[source_device_Id]:$[source_device_name]:$[renamedDeviceName]:$[renamed_devicePath]:$[size_of_the_device_in_bytes]>:$[renamed_Database_name] -renameDatabases $[true] -databaseChain "$[0:5:db2:0]" -sybaseCreateDevices $[true|false] [-toTimeValue $[timeValue] -pointInTime/timeValue]
-
Verify the status of the job. On the command line type the command:
qlist job –j $[job_id]
-
Once the job completes, run the qlogout command to log off the CommServe computer.
Examples
Restoring from a Current Backup
qoperation execute -af restore_template.xml -appName '$[Sybase Database]' -clientName $[client1] -instanceName $[instance1] -destinationInstance/clientName $[client1] -destinationInstance/instanceName $[instance1] -databaseId/name $[db1]
Restoring Databases to a Point-in-Time (date and time)
qoperation execute -af restore_template.xml -clientName $[sybserver3] -instanceName $[S155syb3] -databaseId/name $[db1] -destClient/clientName $[sybserver3] -destinationInstance/clientName $[sybserver3] -destinationInstance/instanceName $[S155syb3] -destinationServer/name $[S155syb3] -devices "$[0:11:0:db1:db1:/Sybase/data/db1.dat:0:newdb1]" -devices "$[0:11:0:db1_log:db1_log:/ sybase/log/db1_log.dat:0:newdb1]" -renameDatabases $[true] -databaseChain "$[0:11:db1:0]" -sybaseCreateDevices $[false] -toTimeValue "$[2015-11-24 16:00:00]"
Generate the Command Line Script from the CommCell Console
In addition to the parameter values provided in the template xml file, if you want to include additional options for the restore, you can do so by selecting the required options from the CommCell Console and generate the command line xml script for the restore operation.
For more information on how to generate the script, see Save as Script Overview.
Rename a Database Restore
Before You Begin
- Create the devices on the destination server.
Procedure
Note: You must perform step-by-step restores from the CommCell Console.
-
Download the rename_restore_template.xml file to the computer where you will run the command.
-
Open the rename_restore_template.xml file, add your specific parameters, and save the file.
For information on supported XML parameters, see Available XML Parameters for Sybase Backups and Restores.
-
On the command line, go to Software_Installation_Directory/Base and type the command.
qoperation execute -af rename_restore_template.xml -clientName $[source_client_name] -instanceName $[source_instance_name] -destClient/clientName $[destination_client_name] -destinationInstance/clientName $[destination_client_name] -destinationInstance/instanceName $[destination_instance_name] -destinationServer/name $[destination_server_name] -databaseId/name $[database_name] -devices $[source subclientId]:$[source dbId]:$[source device Id]:$[source device name]:$[renamedDeviceName]:$[renamed device Path]:$[size of the device in bytes]:$[renamed Database name] -renameDatabases $[true] -databaseChain "$[0:source dbId:database_name:0]" -sybaseCreateDevices $[true|false] [-toTimeValue $[timeValue] -pointInTime/timeValue]
-
Verify the status of the job. On the command line type the command:
qlist job –j $[job_id]
-
Once the job completes, run the qlogout command to log off the CommServe computer.
Finding a database ID from the Sybase Dataserver
Login as Sybase SA user and execute the following SQL script:
isql -Usa –P$[password] -S$[Sybase server name] use master go select $[name, dbid] from $[sysdatabases] where $[name] = ‘$[dbname]’ go exit go
Finding the end time of the job for a Point-in-time restore
Use the following command to find an end time of the job for Point-in-time restore:
./qoperation execscript -sn $[getjoblist.sql] -si $[clientName]
You will receive the list in the following format:
|
JOb ID |
level |
Status |
StoragePolicyName |
Retention Days |
AppType Name |
Subclient Name |
Start Time/End Time |
Active |
|
12774 |
Full |
Success |
SP_Sybase |
-1 |
Sybase Database |
CRA |
2012-08-28 20:06:37.00 |
No |
The command output returns the UTC time and you need to convert this into CommServe time zone before using it in restore command.
Examples
Renaming a database restore without specifying a new device
qoperation execute -af rename_restore_template.xml -clientName $[sybserver3] -instanceName $[S155syb3] -databaseId/name $[db1] -destClient/clientName $[sybserver3] -destinationInstance/clientName $[sybserver3] -destinationInstance/instanceName $[S155syb3] -destinationServer/name $[S155syb3] -devices "$[0:0:0:0:0:0:0:new_db1]" -renameDatabases $[true] -databaseChain "$[0:0:db1:0]" -sybaseCreateDevices $[false]
Renaming a database restore by specifying new devices
qoperation execute -af rename_restore_template.xml -clientName $[sybserver3] -instanceName $[S155syb3] -databaseId/name $[db1] -destClient /clientName $[sybserver3] -destinationInstance/clientName $[sybserver3] -destinationInstance/instanceName $[S155syb3] -destinationServer/name $[S155syb3] -devices "$[0:14:0:db1:new_db1:/sybase/syb155/data/new_db1.dat:125829120:new_db1]" -devices "$[0:14:0:db1_log:new_db1_log:/sybase/syb155/log/new_db1_log.dat:31457280:new_db1]" -renameDatabases $[true] -databaseChain "$[0:14:db1:0]" -sybaseCreateDevices $[true]
Renaming and restoring databases to a point-in-time
qoperation execute -af rename_restore_template.xml -clientName $[sybserver3] -instanceName $[S155syb3] -databaseId/name $[db1] -destClient/clientName $[sybserver3] -destinationInstance/clientName $[sybserver3] -destinationInstance/instanceName $[S155syb3] -destinationServer/name $[S155syb3] -devices "$[0:11:0:db1:db1:/Sybase/data/db1.dat:0:newdb1]" -devices "$[0:11:0:db1_log:db1_log:/ sybase/log/db1_log.dat:0:newdb1]" -renameDatabases $[true] -databaseChain "$[0:11:db1:0]" -sybaseCreateDevices $[false] -toTimeValue "$[2015-11-24 16:00:00]"
Renaming and restoring to a different client (cross server restore) to a point-in-time by specifying a new device
operation execute -af rename_restore_template.xml -clientName $[sybserver3] -instanceName $[S155syb3] -databaseId/name $[db1] -destClient/clientName $[sybserver4] -destinationInstance/clientName $[sybserver4 4] -destinationInstance/instanceName $[S155syb4] -destinationServer/name $[S155syb4] -devices "$[0:11:0:db1:test:/Sybase/data/test.dat:0:test]" -devices "$[0:11:0:db1_log:test_log:/ sybase/log/test_log.dat:0:test]" -renameDatabases $[true] -databaseChain "$[0:11:db1:0]" -sybaseCreateDevices $[false] -toTimeValue "$[2015-11-20 13:00:00]"
Renaming and restoring databases to a point-in-time of the transaction log backups
qoperation execute -af rename_restore_template.xml -clientName $[sybserver3] -instanceName $[S155syb3] -databaseId/name $[db1] -destClient/clientName $[sybserver4] -destinationInstance/clientName $[sybserver4] -destinationInstance/instanceName $[S155syb4] -destinationServer/name $[S155syb4] -devices "$[0:5:0:db1:newdb1:/sybase/syb155/data/newdb1.dat:104857600:newdb1]" -devices "$[0:5:0:db_log:newdb1_log:/sybase/syb155/logs/newdb1_log.dat:20971520:newdb1]" -renameDatabases $[true] -databaseChain "$[0:5:db1:0]" -sybaseCreateDevices $[true] -toTimeValue "$[2015-11-23 10:00:00]" -pointInTime/timeValue "$[2015-11-23 10:00:00]"