Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Serializability wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Navitaire Inc v Easyjet Airline Co. and BulletProof Technologies, Inc. wikipedia , lookup
Relational model wikipedia , lookup
Oracle Database wikipedia , lookup
Ingres (database) wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Database model wikipedia , lookup
Concurrency control wikipedia , lookup
RMAN Setup 3.1 3.1 3. RMAN Setup Setup the RMAN environment Starting RMAN Connecting to RMAN © 2003 SkillBuilders, Inc. © 2003 SkillBuilders, Inc. SKILLBUILDERS V 1.2 RMAN Setup 3.2 3.2 3.2 3.2 RMAN Installation ¾ RMAN utility installed with: ¾ Database install (any edition) ¾ Client “Administration” install ¾ Standard edition limited ¾ No parallel support © 2003 SkillBuilders, Inc. © 2003 SkillBuilders, Inc. V 1.2 RMAN Setup 3.3 3.3 3.3 3.3 User “RMAN” ¾ Create or unlock user RMAN ¾ RMAN needs RECOVERY_CATALOG_OWNER role system@DAVE> system@DAVE> alter alter user user rman rman account account unlock; unlock; User User altered. altered. system@DAVE> system@DAVE> connect connect rman/rman rman/rman Connected. Connected. create create user user rman rman identified identified by by rman... rman... grant grant connect, connect, resource, resource, recovery_catalog_owner recovery_catalog_owner to to rman; rman; © 2003 SkillBuilders, Inc. 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 9i 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. © 2003 SkillBuilders, Inc. V 1.2 RMAN Setup 3.4 3.4 3.4 3.4 Password File… ¾ Need to connect to two databases ¾ At least one connection must be remote ¾ Target database login issued by RMAN is always SYSDBA ¾ Must: ¾ ¾ ¾ Create password file to support remote SYSDBA connections Grant SYSDBA to user Set remote_login_passwordfile = exclusive © 2003 SkillBuilders, Inc. 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 © 2003 SkillBuilders, Inc. V 1.2 RMAN Setup 3.5 3.5 3.5 3.5 …Password File ¾ Query contents of password file: system@TEST> system@TEST> select select ** from from v$pwfile_users; v$pwfile_users; USERNAME SYSDB USERNAME SYSDB SYSOP SYSOP --------------------------------------------------------------- ----- --------SYS TRUE SYS TRUE TRUE TRUE SYSTEM TRUE SYSTEM TRUE FALSE FALSE © 2003 SkillBuilders, Inc. The V$PWFILE_USERS view displays the contents of the password file. © 2003 SkillBuilders, Inc. V 1.2 RMAN Setup 3.6 3.6 3.6 3.6 Oracle Net ¾ Remote connections need TNSNAME.ORA entry BEATLES BEATLES == Target database (DESCRIPTION (DESCRIPTION == (ADDRESS_LIST (ADDRESS_LIST == (ADDRESS (ADDRESS == (PROTOCOL (PROTOCOL == TCP)(HOST TCP)(HOST == 10.0.0.50)(PORT 10.0.0.50)(PORT == 1521)) 1521)) )) (CONNECT_DATA (CONNECT_DATA == (SERVER (SERVER == DEDICATED) DEDICATED) (SERVICE_NAME (SERVICE_NAME == test) test) )) Must use dedicated )) connection © 2003 SkillBuilders, Inc. Since at least one of the two connections you will need to make will be a remote connection (using Oracle Net), you’ll 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))) © 2003 SkillBuilders, Inc. V 1.2 RMAN Setup 3.7 3.7 3.7 3.7 Catalog Tablespace ¾ Setup a separate database to hold recovery catalog ¾ Create a tablespace to hold recovery catalog system@DAVE> system@DAVE> create create tablespace tablespace rcat rcat datafile datafile size size 50m; 50m; Tablespace Tablespace created. created. system@DAVE> system@DAVE> alter alter user user rman rman 22 default default tablespace tablespace rcat rcat 33 quota quota unlimited unlimited on on rcat; rcat; User User altered. altered. © 2003 SkillBuilders, Inc. Whether you have created a new user called RMAN or just unlocked the user created by the database creation scripts, you’ll 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. © 2003 SkillBuilders, Inc. V 1.2 RMAN Setup 3.8 3.8 3.8 3.8 Create Catalog ¾ Create catalog ¾ Register the target database Start RMAN, connect to target and catalog databases. C:\>rman C:\>rman target=system/dave@beatles target=system/dave@beatles catalog=rman/rman catalog=rman/rman RMAN> RMAN> create create catalog catalog tablespace tablespace rcat; rcat; recovery recovery catalog catalog created created Create a new catalog © 2003 SkillBuilders, Inc. The recovery catalog is a series of tables and views owned by RMAN. (You can easily see the object 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 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 © 2003 SkillBuilders, Inc. V 1.2 RMAN Setup 3.9 3.9 3.9 3.9 Register Database ¾ Register the target database in the catalog RMAN> RMAN> register register database; database; database database registered registered in in recovery recovery catalog catalog starting full resync of starting full resync of recovery recovery catalog catalog full full resync resync complete complete rman@DAVE> rman@DAVE> select select dbid, dbid, name name from from rc_database; rc_database; DBID DBID NAME NAME ------------------- ----------------------------------------------------------1808373586 1808373586 TEST TEST © 2003 SkillBuilders, Inc. 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. © 2003 SkillBuilders, Inc. V 1.2 RMAN Setup 3.10 3.10 3.10 3.10 Startup Options… ¾ Start RMAN from the OS command prompt C:\>rman C:\>rman target=sys/change_on_install@prod target=sys/change_on_install@prod catalog=rman/rman@recovery catalog=rman/rman@recovery ¾ Optional LOGFILE option C:\>rman C:\>rman .. .. .. LOG=c:\oracle\backups\rman.log LOG=c:\oracle\backups\rman.log ¾ Can start command files C:\>rman C:\>rman …cmdfile …cmdfile "c:\rman\backup.rmn" "c:\rman\backup.rmn" © 2003 SkillBuilders, Inc. 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. © 2003 SkillBuilders, Inc. V 1.2 RMAN Setup 3.11 3.11 3.11 3.11 …Startup Options ¾ Start RMAN without parameters ¾ More secure ¾ Prevents snooping password with UNIX ps command C:\>rman C:\>rman Recovery Recovery Manager: Manager: Release Release 9.0.1.1.1 9.0.1.1.1 -- Production Production (c) Copyright 2001 Oracle Corporation. (c) Copyright 2001 Oracle Corporation. All All rights rights re re RMAN> RMAN> connect connect target target sys/change_on_install sys/change_on_install connected to target connected to target database: database: PROD PROD (DBID=4167529595) (DBID=4167529595) RMAN> RMAN> connect connect catalog catalog rman/rman@recovery rman/rman@recovery connected to recovery connected to recovery catalog catalog database database Connect to catalog DB before doing ops that require repository © 2003 SkillBuilders, Inc. 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. © 2003 SkillBuilders, Inc. V 1.2 RMAN Setup 3.12 3.12 3.12 3.12 Lesson Summary ¾ Setup the RMAN environment ¾ Creating the RMAN user ¾ Password file ¾ TNSNAMES.ORA ¾ Catalog Tablespace ¾ Registering the target database ¾ Starting and connecting to RMAN ¾ Start RMAN session from OS command prompt ¾ Connect to catalog and recovery databases © 2003 SkillBuilders, Inc. Helpful resources: ¾ Supplied script rman_getting_started.sql. (Also available at www.skillbuilders.com.) ¾ Oracle9i Recovery Manager Users Guide, Chapters 2,3 and 16 ¾ Compatibility issues – See Compatibility Matrix on metalink.oracle.com © 2003 SkillBuilders, Inc. V 1.2 RMAN Setup 3.13 3.13 3.13 3.13 RMAN Setup and Login Workshop ¾ RMAN Setup and Login © 2003 SkillBuilders, Inc. This workshop asks that you create a recovery catalog to use in the remaining exercises. To reduce the time necessary to complete this workshop, we will create the recovery catalog within the sample database that has been provided for your use in this class. (In a production environment, we recommend that you create the recovery catalog in a separate databaseoptimally on a separate machine.) 1. Create a 50Mb tablespace called “RCAT” to hold the recovery catalog. 2. Create or unlock a user called RMAN (password RMAN). Set the default tablespace to the tablespace created in step 1. 3. Grant the necessary privileges to the user RMAN. 4. 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. 5. Create the recovery catalog. Continued… © 2003 SkillBuilders, Inc. V 1.2 RMAN Setup 6. Exit RMAN and check the log file for errors. 7. 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. 8. Register the database in the RMAN catalog. 9. Exit RMAN. © 2003 SkillBuilders, Inc. 3.14 3.14 V 1.2