BrightStor ARCserve Backup Support for Oracle Backup and Restore on Windows 64-Bit Platform - 1 -
TABLE OF CONTENTS 1. Summary... 3 2. Backup and Restore Process... 3 3. RMAN Command and Script Template... 4 3.1 Oracle 8.0... 4 3.2 Oracle 8i and Oracle 9i... 5 3.3 Oracle 10gr1 and Oracle 10gr2... 5 4. Parameter File Backup and Restore... 7 5. Backup and Restore Steps... 7 5.1 Backup... 7 5.2 Restore... 8 6. Backup and Restore Example... 8 6.1 Environment... 8 6.2 Backup... 8 6.3 Restore... 14 7. Error Conditions and Exceptions... 20 8. Appendix... 24-2 -
1. Summary The BrightStor ARCserve Backup r11.5 SP2 Windows Oracle Agent does not support the backup and restore of Oracle databases on a Windows 64-bit platform. This document provides a semi-automated workaround to support the backup and restore of Oracle databases on a Windows 64-bit platform. Backup and restore can be achieved manually by using the Oracle command line backup utility RMAN to back up the Oracle DB backup pieces to disk. These backup pieces are then backed up using the ARCserve Client Agent. During restore, these backup pieces are restored to their original location on disk using the ARCserve Client Agent. Finally, the RMAN restore script is used to restore and recover the database. Section 3 lists the RMAN script templates that are most commonly used for backup and recovery. For more information, see the following Oracle manuals: Backup and Recovery Basics Backup and Recovery Advanced User's Guide Backup and Recovery Reference 2. Backup and Restore Process RMAN 1 ARCserve Client Agent for Windows 3 Tape /Disk 2 4 Oracle DB Server Disk Backup Server Oracle Database Server ARCserve Backup Server - 3 -
Note: Optionally, the Oracle DB server and the ARCserve backup server can be hosted on the same machine. Backup Process 1. Run RMAN scripts to back up the Oracle DB to disk. 2. Windows Client Agent installed on the Oracle DB server machine backs up the Oracle DB backup pieces stored on disk and sends them to the backup server. 3. ARCserve Backup server backs up the Oracle backup pieces to tape as a restorable session. Restore Process 1. Submit a restore job from ARCserve server. 2. The ARCserve Client agent for Windows restores the session to disk. 3. Run RMAN restore scripts to recover the Oracle DB pieces from disk. 3. RMAN Command and Script Template Note that the bold characters are version-related. All the user-specific parameters are italicized. 3.1 Oracle 8.0 1. RMAN Command RMAN80.EXE TARGET <target DB user name>/<target DB user password>@<target DB name> NOCATALOG CMDFILE= <script file full path name> Or, if a Catalog Database will be used: RMAN80.EXE TARGET <target DB user name>/<target DB user password>@<target DB name> RCVCAT <catalog DB user name>/< catalog DB user password>@< catalog DB name> CMDFILE= <script file full path Backup Script RUN{ ALLOCATE CHANNEL <channel name> TYPE DISK FORMAT <file path>\<file name prefix>%u_%p<file name suffix>.<file extend name> ; BACKUP FULL DATABASE; SQL ALTER SYSTEM ARCHIVE LOG CURRENT ; BACKUP ARCHIVELOG ALL; BACKUP CURRENT CONTROL FILE; - 4 -
RELEASE CHANNEL <channel name>; } 2. List Script List backup of database/<tablespace names>/controlfile/archivelog; 3. Restore Script RUN{ ALLOCATE CHANNEL <channel name> TYPE DISK; RESTORE DATABASE; RECOVER DATABASE; RELEASE CHANNEL <channel name>; } 3.2 Oracle 8i and Oracle 9i 1. RMAN Command RMAN.EXE TARGET <target DB user name>/<target DB user password>@<target DB name> NOCATALOG CMDFILE= <script file full path name> Or, if a Catalog Database will be used: RMAN.EXE TARGET <target DB user name>/<target DB user password>@<target DB name> CATALOG <catalog DB user name>/< catalog DB user password>@< catalog DB name> CMDFILE= <script file full path name> 2. Backup Script RUN{ ALLOCATE CHANNEL <channel name> TYPE DISK FORMAT <file path>\<file name prefix>%u_%p_%c<file name suffix>.<file extend name> ; BACKUP FULL DATABASE; SQL ALTER SYSTEM ARCHIVE LOG CURRENT ; BACKUP ARCHIVELOG ALL; BACKUP CURRENT CONTROL FILE; RELEASE CHANNEL <channel name>; } 3. List Script See Oracle 80 List Script. 4. Restore Script See Oracle 80 Restore Script. 3.3 Oracle 10gr1 and Oracle 10gr2 1. RMAN Command See Oracle 8i and Oracle 9i, RMAN Command. - 5 -
2. Backup Script RUN{ ALLOCATE CHANNEL <channel name> DEVICE TYPE DISK FORMAT <file path>\<file name prefix>%u_%p_%c<file name suffix>.<file extend name> ; BACKUP FULL DATABASE; SQL ALTER SYSTEM ARCHIVE LOG CURRENT ; BACKUP ARCHIVELOG ALL; BACKUP CURRENT CONTROL FILE; RELEASE CHANNEL <channel name>; } 3. List Script See Oracle 80 List Script. - 6 -
4. Restore Script RUN{ ALLOCATE CHANNEL <channel name> DEVICE TYPE DISK; RESTORE DATABASE; RECOVER DATABASE; RELEASE CHANNEL <channel name>; } 4. Parameter File Backup and Restore The two Oracle Parameter Files are the PFILE and the SPFILE. By default, the PFILE is located in %ORACLE_HOME%\database\init<ORACLE_SID>.ora; the SPFILE is located in %ORACLE_HOME%\database\spfile<ORACLE_SID>.ora. However, these two files could be located anywhere. Before you back up a specific set of these files, make sure that the set that you are backing up is in use currently by the instance that you are backing up and that it is not a backup copy taken at a point in time. We suggest that you use the ARCserve Client Agent to backup and restore the Oracle Parameter Files. Simply treat them as common files for backup and restore. 5. Backup and Restore Steps 5.1 Backup 1. Write an RMAN backup script file following the format as indicated in the template shown in Section 3. If you want to back up other individual database objects, for example, tablespaces or datafiles, see the appendix to find the appropriate RMAN commands. Note: For more information, see the following Oracle manuals: Backup and Recovery Basics Backup and Recovery Advanced User's Guide Backup and Recovery Reference 2. Go to the command prompt, and execute the RMAN script. 3. Check the RMAN command output. Verify that the script runs without generating errors. 4. Check the backup pieces in the specific folder. Verify that the files are there, and the file names are the same as in the RMAN command output. 5. Use the ARCserve Client Agent to back up the backup pieces generated by the - 7 -
RMAN command. 6. Use the ARCserve Client Agent to back up the Oracle Parameter Files. 7. Verify in the BrightStor.log and the ARCserve database that the backup succeeded and that all files are backed up. 5.2 Restore 1. Write an RMAN list script. 2. Go to the command prompt, and execute the RMAN script. 3. Identify through review of the backup catalog information what you need to restore. 4. Restore the desired backup pieces to the original location using the ARCserve Client Agent from the ARCserve Manager. 5. Make sure that all the backup pieces are restored to the original location. 6. Modify the Oracle database status for restore. 7. Write an RMAN restore script. 8. Go to the command prompt, and execute the RMAN restore script. 9. Check the RMAN command output. Verity the script runs without generating errors. 10. Alter the database to reflect the expected status. Verify the restored Oracle database content manually. 6. Backup and Restore Example 6.1 Environment 1. IA64, 64-bit Windows 2003 Enterprise server. 2. 64-bit Oracle 10gr2. The Oracle database instance name is ORADB and does not configure the Catalog Database. The Oracle user name is sys ; the password is oracle. 3. 64-bit ARCserve Client Agent. 4. ARCserve server is deployed on another 32-bit machine. 5. Two channels are used for the RMAN backup. 6. The backup script file name is d:\scripts\backup.sql. The restore script file name is d:\scripts\restore.sql. The list script file name is d:\scripts\list.sql. 7. The backup destination is d:\backup pieces\. 6.2 Backup 1. Write an RMAN backup script file, c:\backup.sql. The content of the script file follows: RUN{ ALLOCATE CHANNEL dev1 DEVICE TYPE DISK - 8 -
FORMAT d:\backup pieces\%u_%p_%c ; ALLOCATE CHANNEL dev2 DEVICE TYPE DISK FORMAT d:\backup pieces\%u_%p_%c ; BACKUP FULL DATABASE; SQL ALTER SYSTEM ARCHIVE LOG CURRENT ; BACKUP ARCHIVELOG ALL; BACKUP CURRENT CONTROL FILE; RELEASE CHANNEL dev1; RELEASE CHANNEL dev2; } 2. Execute a cmd command. 3. Execute the RMAN command: RMAN.EXE TARGET sys/oracle@oradb NOCATALOG CMDFILE= d:\scripts\backup.sql - 9 -
- 10 -
4. Check the RMAN command output for errors. - 11 -
5. Check the backup pieces in the specific folder. All files should be there, and the file names should be the same as in the RMAN command output. 6. Use the ARCserve Client Agent to back up the backup pieces generated by the RMAN command. - 12 -
7. Use the ARCserve Client Agent to back up the Oracle Parameter Files. 8. Check the ARCserve database to make sure that the backup succeeds and all the files are backed up. - 13 -
6.3 Restore 1. Before restoring, delete the backed up files under d:\backup pieces. 2. Write an RMAN list script file c:\list.sql. The content of the script file follows: List backup of database; - 14 -
3. Execute a cmd command. 4. Execute the RMAN command: RMAN.EXE TARGET sys/oracle@oradb NOCATALOG CMDFILE= d:\scripts\list.sql 5. Check the backup catalog information to identify what needs to be restored. Write down which backup pieces you need: D:\BACKUP PIECES\0CI03BNJ_1_1 D:\BACKUP PIECES\0BI03BNJ_1_1-15 -
6. Restore the desired backup pieces to the original location using the ARCserve Client Agent. - 16 -
7. Make sure that all the backup pieces are restored to the original location before you perform the following task. 8. Modify the Oracle Database to the specific status for restore operations. In this example, the entire database (excluding the control file) will be restored. The database should be in a MOUNT state. For more information, see the Oracle Administrator's Guide. - 17 -
9. Write an RMAN restore script file c:\restore.sql. The content of the script file follows: RUN{ ALLOCATE CHANNEL dev1 DEVICE TYPE DISK; RESTORE DATABASE; RECOVER DATABASE; RELEASE CHANNEL dev1; } 10. Execute a cmd command. 11. Execute the RMAN command: RMAN.EXE TARGET sys/oracle@oradb NOCATALOG CMDFILE= d:\scripts\restore.sql 12. Check the RMAN command output. In this example, there are no errors. - 18 -
13. Alter the database to reflect the expected status. In this example, the database status is OPEN Verify the restored Oracle database content manually. - 19 -
7. Error Conditions and Exceptions In the following example, the RMAN script file full path contained blank characters. Use a short path to avoid this situation. - 20 -
1. To restore the backup to an alternative location, modify the database catalog information accordingly. For more information, see the Oracle Backup and Recovery Reference guide. The following example uses the List backup of database command to check the current backup catalog information. No backups are available because all of the backup information was previously cleared. The backup pieces are all available on disk, so you can import the catalog information from the backup pieces using the catalog backuppiece <backup piece name> command. Run the List backup of database command again to view the catalog information with new file locations on the C drive. The original locations are the same as in the preceding example. - 21 -
- 22 -
2. Sometimes the parameter file does not contain real content; instead, it contains a link to another file. After you create a new database, one PFILE will be located in %ORACLE_HOME%\database\init<ORACLE_SID>.ora, but its content is a file link. In this situation, if you want to back up the parameter files, back up both the PFILE and the SPFILE file as part of the backup process, for example: D:\oracle\product\10.2.0\db_1\database\initORADB.ora and D:\oracle\product\10.2.0\db_1/dbs/spfileORADB.ora - 23 -
8. Appendix 1. Recommendations for restoring Oracle Parameter and Control files follow. a) Restore the Oracle Parameter Files only if the following problems are encountered: The database cannot be started because of a problem with the parameter file. The Oracle Parameter File has been deleted. The database was restored to another machine. b) Restore the Oracle Control Files only if the following problems are encountered: The Oracle Control File has been deleted. The database was restored to another machine. 2. Some useful RMAN commands follow. For advanced RMAN commands, see the Oracle Backup and Recovery Reference guide. a) Back up tablespaces and datafiles. RUN{ ALLOCATE CHANNEL dev1 DEVICE TYPE DISK; BACKUP TABLESPACE <tablespace name>, <tablespace name>; BACKUP DATAFILE <datafile name>, <datafile name> ; RELEASE CHANNEL dev1; } b) List the backup of database, tablespaces, datafiles, control file, and archivelogs. LIST BACKUP; LIST BACKUP OF DATABASE; LIST BACKUP OF TABLESPACE <tablespace name>, <tablespace name>; LIST BACKUP OF DATAFILE <datafile name>, <datafile name> ; LIST BACKUP OF CONTROLFILE; LIST BACKUP OF ARCHIVELOG ALL; c) Check for the existence of the backup piece on the local disk. CROSSCHECK BACKUP; CROSSCHECK BACKUP OF DATABASE; CROSSCHECK BACKUP OF CONTROLFILE; CROSSCHECK BACKUP OF ARCHIVELOG ALL; - 24 -
d) Delete the expired backup pieces in the Oracle Information Catalog. To get the primarykey value of the backupset, use the LIST command as described previously. DELETE EXPIRED BACKUP; DELETE EXPIRED BACKUP OF DATABASE; DELETE EXPIRED BACKUP OF CONTROLFILE; DELETE EXPIRED BACKUP OF ARCHIVELOG ALL; DELETE EXPIRED BACKUPPIECE <primarykey>, <primarykey>; DELETE EXPIRED BACKUPSET <primarykey>, <primarykey>; e) Add backup pieces to the Oracle Information Catalog. CATALOG BACKUPPIECE <bakcuppiece file path>, <bakcuppiece file path>; f) Validate the backup piece on the local disk. To get the primarykey value of the backupset, use the LIST command as described previously. VALIDATE BACKUPSET <primarykey>,<primarykey>; - 25 -