Instructor's Notes
(If applicable)
- Lesson 3 – RMAN Setup (Getting Started with RMAN)
- Author: Dave Anderson, SkillBuilders
- www.skillbuilders.com
- Last Update: October 17, 2007
- In this lesson you will learn how to:
- Setup the RMAN environment
- Start the RMAN executable
- Connect to the target and catalog databases.
Other Text:
(Examples or comments displayed on slide, if any).
Instructor's Notes
(If applicable)
- This is a hands-on lesson on setting up, starting and connecting to RMAN.
Other Text:
(Examples or comments displayed on slide, if any).
Instructor's Notes
(If applicable)
- The RMAN utility (i.e. the executable) is installed with all Oracle Database editions – no extra installation is required. To install the executable on a client computer, select the “Client Administration” installation option from the Oracle Universal Installer.
- Some Oracle Database editions, such as Standard Edition, have limited feature support. For example, Standard Edition only supports single-threaded backup and restore operations – parallel operations is not supported with Oracle SE.
Other Text:
(Examples or comments displayed on slide, if any).
Instructor's Notes
(If applicable)
- The database containing the recovery catalog needs a user called “RMAN” (Actually, the user does not have to be called RMAN, but this is obvious and convenient.)
- Some Oracle database creation scripts pre-create a user RMAN. If that is the case in your environment, simply unlock the account. If user RMAN does not exist, create with and grant the privileges shown above.
Other Text:
(Examples or comments displayed on slide, if any).
system@DAVE> alter user rman account unlock;
<br>
<br>User altered.
<br>
<br>system@DAVE> connect rman/rman
<br>Connected.<br>create user rman identified by rman...
<br>
<br>grant connect, resource, recovery_catalog_owner to rman;<br>
Instructor's Notes
(If applicable)
- Consider this: the RMAN client program needs to connect to two databases – the target and the recovery catalog. Since it is not possible to connect locally (i.e. without an Oracle Net connect string) to two databases, one of the connections must be a remote Oracle Net connection. If the remote connection in your environment is to the target database, you will need to :
- Create a password file on the target database (this is done with the ORAPWD utility).
- Grant SYSDBA privilege to the user you will connect with.
- Set the REMOTE_LOGIN_PASSWORDFILE parameter equal to EXCLUSIVE to support remote SYSDBA logins.
- If you receive the following error, it is likely that you do not have a password file in the remote target database or the user you are attempting to connect with does not have SYSDBA privilege (which means the user is not in the password file):
- RMAN> connect target system/dave@beatles
- RMAN-00571: ================================================
- RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ==
- RMAN-00571: ================================================
- ORA-01031: insufficient privileges
Other Text:
(Examples or comments displayed on slide, if any).
Instructor's Notes
(If applicable)
- Query the V$PWFILE_USERS view to display the contents of the password file.
Other Text:
(Examples or comments displayed on slide, if any).
system@TEST> select * from v$pwfile_users;
<br>
<br>USERNAME SYSDB SYSOP
<br>------------------------------ ----- -----
<br>SYS TRUE TRUE
<br>SYSTEM TRUE FALSE<br>
Instructor's Notes
(If applicable)
- Since at least one of the two connections you will need to make will be a remote connection (using Oracle Net), you will need to define an entry in the TNSNAMES.ORA configuration file. Modify TNSNAMES.ORA on the machine you want to make the remote connection from. Note that a dedicated connection is required.
- You can test the address specified in the TNSNAMES entry with the TNSPING command (note that TNSPING does not check that the SERVICE_NAME parameter is correct):
- C:\>tnsping beatles
- TNS Ping Utility for 32-bit Windows: Version 9.2.0
- Copyright (c) 1997 Oracle Corporation. All rights
- Used parameter files: C:\oracle\ora92\network\admin\sqlnet.ora
- Used TNSNAMES adapter to resolve the alias
- Attempting to contact (DESCRIPTION = (ADDRESS_LIST
- (HOST = 10.0.0.50)(PORT = 1521))) (CONNECT_DATA =
- NAME = beatles)))
Other Text:
(Examples or comments displayed on slide, if any).
BEATLES =
<br> (DESCRIPTION =
<br> (ADDRESS_LIST =
<br> (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.0.50)(PORT = 1521))
<br> )
<br> (CONNECT_DATA =
<br> (SERVER = DEDICATED)
<br> (SERVICE_NAME = test)
<br> )
<br> )<br>Target database<br>Must use dedicated connection<br>
Instructor's Notes
(If applicable)
- Whether you have created a new user called RMAN or just unlocked the user created by the database creation scripts, you will need to create tablespace and alter the RMAN user as shown above. 50M of space is most often more than enough space for a recovery catalog.
- Note that I had some issues using the name “RECOVERY” for this tablespace in a 9.0.1 environment – it later complained that “RECOVERY” was a reserved word. Also note that the default tablespace for the pre-created user RMAN is TOOLS – I prefer a separate dedicated tablespace for the recovery catalog.
Other Text:
(Examples or comments displayed on slide, if any).
system@DAVE> create tablespace rcat datafile size 50m;
<br>
<br>Tablespace created.
<br>
<br>system@DAVE> alter user rman
<br> 2 default tablespace rcat
<br> 3 quota unlimited on rcat;
<br>
<br>User altered.<br>
Instructor's Notes
(If applicable)
- The recovery catalog is a series of tables and views owned by RMAN. (You can easily see the objects that comprise the catalog by logging into RMAN and executing SELECT OBJECT_NAME FROM USER_OBJECTS;) As shown in the example above, the catalog is created with the RMAN command CREATE CATALOG.
- The RMAN line-mode utility is started from the OS command prompt. The command shown above starts RMAN and connects to both databases, the target and the recovery database. RMAN automatically and implicitly adds “AS SYSDBA” to the target database connection attempt.
- Note that if you were provided a pre-created RMAN user, there is probably already a catalog in the TOOLS tablespace. This must be removed before creating the new catalog in the RCAT tablespace with the DROP CATALOG command:
- RMAN> drop catalog;
- recovery catalog owner is RMAN
- enter DROP CATALOG command again to confirm catalog removal
- RMAN> drop catalog;
- recovery catalog dropped
Other Text:
(Examples or comments displayed on slide, if any).
C:\>rman target=system/dave@beatles catalog=rman/rman
<br>
<br>RMAN> create catalog tablespace rcat;
<br>
<br>recovery catalog created<br>Start RMAN, connect to target and catalog databases.<br>Create a new catalog<br>
Instructor's Notes
(If applicable)
- The REGISTER DATABASE command registers the target database in the recovery catalog tables. After executing REGISTER DATABASE you will see your target database in the RC_DATABASE view.
- Issue
- Note that after dropping the pre-created catalog and recreating a new catalog in the RCAT tablespace, I received the following error when attempting to register my database:
- RMAN> register database;
- RMAN-00571: =======================================================
- RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
- RMAN-00571: ===========================================
- RMAN-03009: failure of register command on default channel at
- ORA-04062: timestamp of package "RMAN.DBMS_RCVCAT" has been cha
- Exiting RMAN and reentering solved the problem.
Other Text:
(Examples or comments displayed on slide, if any).
RMAN> register database;
<br>
<br>database registered in recovery catalog
<br>starting full resync of recovery catalog
<br>full resync complete<br>rman@DAVE> select dbid, name from rc_database;
<br>
<br> DBID NAME
<br>---------- ------------------------------
<br>1808373586 TEST<br>
Instructor's Notes
(If applicable)
- The RMAN line-mode utility is started from the OS command prompt. The command:
- C:\>rman target=sys/change_on_install@prod catalog=rman/rman@recovery
- starts RMAN and connects to both databases, the target and the recovery database. Both “prod” and “recovery” need to be valid entries in the TNSNAMES.ORA file. The userid used to connect to the TARGET database must have SYSDBA privilege. RMAN automatically adds “AS SYSDBA” to the target database connection attempt.
- Use the LOG (or LOGFILE) option to cause RMAN to write all output to the specified logfile. Unfortunately, it does not also write the output to the screen.
- The “CMDFILE” option allows you to specify a text file that contains the RMAN commands. If the last command is EXIT;, then you can create schedulable batch jobs.
Other Text:
(Examples or comments displayed on slide, if any).
C:\>rman target=sys/change_on_install@prod catalog=rman/rman@recovery<br>C:\>rman . . . LOG=c:\oracle\backups\rman.log<br>C:\>rman …cmdfile "c:\rman\backup.rmn"<br>
Instructor's Notes
(If applicable)
- We can see in this slide that starting RMAN can be done differently. For example, RMAN starts without any parameters; connections to the databases can be done separately with the CONNECT command after entering this RMAN environment.
- This is a more secure connection method because it prevents password discovery with the Unix “ps” command (the ps command reports on all active processes). The output of the following command:
- $ ps –ef | grep rman
- would show the entire RMAN command, passwords and all, if passwords were used on the initial RMAN command.
- Note that you need to connect to the catalog database before performing an operation that requires the repository. Otherwise, RMAN uses the control file repository for the remainder of the session; you will need to exit and restart RMAN to connect to the catalog database.
Other Text:
(Examples or comments displayed on slide, if any).
C:\>rman
<br>Recovery Manager: Release 9.0.1.1.1 - Production
<br>(c) Copyright 2001 Oracle Corporation. All rights re
<br>
<br>RMAN> connect target sys/change_on_install
<br>connected to target database: PROD (DBID=4167529595)
<br>
<br>RMAN> connect catalog rman/rman@recovery
<br>connected to recovery catalog database<br>Connect to catalog DB before doing ops that require repository<br>
Instructor's Notes
(If applicable)
- In this lesson you learned:
- How to Setup the RMAN environment
- How to Create the RMAN user
- About the Password file and TNSNAMES.ORA
- Creating the Catalog Tablespace
- Registering the target database
- How to start and connect to the target and catalog databases
- Starting the RMAN session from OS command prompt
- Helpful resources:
- Supplied script RMAN_GETTING_STARTED.SQL. (Also available at www.skillbuilders.com.)
- Oracle9i Recovery Manager Users Guide, Chapters 2,3 and 16
- Oracle Database 10g Backup and Recovery Basics
- Oracle Database 10g Backup and Recovery Advanced User’s Guide
- For compatibility issues see the “Compatibility Matrix” on http://METALINK.ORACLE.COM
Other Text:
(Examples or comments displayed on slide, if any).
Instructor's Notes
(If applicable)
- This workshop asks that you create a recovery catalog to use in the remaining exercises.
- Choose one of the following three options as the location for your catalog database:
- A. Use another student’s database as your recovery catalog database (he or she will use your database as their recovery catalog database). Add an entry in your tnsnames.ora file to connect to this database.
- B. Create the recovery catalog within a database that has been provided for your use in this class. Ask your instructor for the IP address and instance name. Add an entry in your tnsnames.ora file to connect to this database.
- C. If you do not have a second Oracle host, create the recovery catalog in a 2nd database on your server. In this case use the Oracle DBCA to create a second database on your server. Deselect all installable options such as OLAP and Data Mining to reduce the time required to create this database.
- Once you have chosen the location of your recovery catalog, do the following steps in your recovery catalog database:
- Create a 50Mb tablespace called “RCAT” to hold the recovery catalog.
- Workshop continues on the next page…
Other Text:
(Examples or comments displayed on slide, if any).
Instructor's Notes
(If applicable)
- Create or unlock a user called RMAN (password RMAN). Set the default tablespace to the tablespace created in step 1.
- Grant the necessary privileges to the user RMAN.
- Start the RMAN utility from the OS command prompt. For this step, consider using the LOG option. Connect to the database that contains the recovery catalog tablespace with the user RMAN. Optional: Create a CMDFILE that contains the commands for steps 5 and 6.
- Create the recovery catalog. Exit RMAN and check the log file for errors.
- Start the RMAN utility from the OS command prompt. For this step, consider using the LOG option. Connect to the database that contains the recovery catalog tablespace with the user RMAN. Also connect to the target database. Optional: Create a CMDFILE that contains the commands for step 8.
- Register the database in the RMAN catalog.
- Exit RMAN.
Other Text:
(Examples or comments displayed on slide, if any).