Sunday, July 12, 2015

Create An RMAN Recovery Catalog Database

- Environment info
 
catalog database sid: rcat
catalog schema owner: rcatowner
target database sid: orcl1
hostname: orcl1.localdomain

1. create catalog database with dbca command without using Enterprise Manager or sample schemas sid & uniqname
 
[oracle@orcl1 ~]$ dbca &

2. check RCAT instance entry in tnsnames.ora file
 
[oracle@orcl1 ~]$ vim /u01/app/oracle/product/11203/db_1/network/admin/tnsnames.ora

3. change current oracle sid to RCAT
 
[oracle@orcl1 ~]$ . oraenv
ORACLE_SID = [orcl1] ? rcat

4. login to RCAT database instance
 
SQL> select name from v$database;

NAME
---------
RCAT

SQL> col file_name format a45
SQL> select file_name, tablespace_name from dba_data_files;

FILE_NAME          TABLESPACE_NAME
--------------------------------------------- ------------------------------
+DATA/rcat/datafile/users.270.884809739       USERS
+DATA/rcat/datafile/undotbs1.269.884809739    UNDOTBS1
+DATA/rcat/datafile/sysaux.268.884809739      SYSAUX
+DATA/rcat/datafile/system.267.884809739      SYSTEM

5. create tablespace for recovery catalog with name rcat_ts
 
SQL> create tablespace rcat_ts datafile '+DATA/rcat/datafile/rcat.dbf' size 15M;

Tablespace created.

6. create a user RCATOWNER who owner of recovery catalog schema and grant him recovery_catalog_owner privilegs
 
SQL> create user rcatowner identified by oracle
  2  default tablespace rcat_ts quota unlimited on rcat_ts;

User created.

SQL> grant recovery_catalog_owner to rcatowner;

Grant succeeded.

7. switch to ORCL1 database instance and login to rman catalog to create catalog
 
[oracle@orcl1 ~]$ . oraenv
ORACLE_SID = [rcat] ? orcl1

[oracle@orcl1 ~]$ rman catalog rcatowner@rcat
recovery catalog database Password:
connected to recovery catalog database

RMAN> create catalog;

recovery catalog created

8. check recovery catalog tables creation
 
[oracle@orcl1 ~]$ sqlplus sys@rcat as sysdba

SQL> select table_name from dba_tables
  2  where owner = 'RCATOWNER';
44 rows selected.

SQL> select object_name from dba_objects
  2  where owner = 'RCATOWNER';
252 rows selected.

9. register target database ORCL1 using rman recovery catalog database RCAT
 
    [oracle@orcl1 ~]$ rman target / catalog rcatowner@rcat
    connected to target database: ORCL1 (DBID=1269258514)
    recovery catalog database Password:
    connected to recovery catalog database
    RMAN> register database;
    RMAN> report schema;


10. configure Enterprise Manager to use recovery catalog


Enterprise Manager > Availability


> Recovery Catalog Settings > Use Recovery Catalog
> Add Recovery Catalog
 
host: orcl1.localdomain
port: 1521
sid: rcat
* Recovery Catalog Username: rcatowner
* Recovery Catalog Password:

next > finish

>>>>>>>>>>>>>>>>> Create a script to startup & shutdown Oracle database & Enterprise Manager <<<<<<<<<<<<<<<<<<<<<

- Create startup script
$ vim startup.sh
#!/bin/bash
echo "start ORCL Database"
srvctl start db -d orcl
echo "start RCAT Database"
srvctl start db -d rcat
echo "start LISTENER"
lsnrctl start
echo "start Enterprise Manager"
emctl start dbconsole
echo "############### WELCOME ##############"

- Create shutdown script
$ vim shutdown.sh
#!/bin/bash
echo "stop Enterprise Manager"
emctl stop dbconsole
echo "stop RCAT Database"
srvctl stop db -d rcat
echo "stop ORCL Database"
srvctl stop db -d orcl
echo "stop ASM instance"
. oraenv << EOI
+ASM
EOI
echo "stop LISTENER"
lsnrctl stop
echo "############# BYE BYE ##############"


- Change files to be executable
 
$ chmod +x startup.sh
$ chmod +x shutdown.sh

- Using scripts to startup & shutdown Oracle database
 
$ ~/startup.sh
$ ~/shutdown.sh

No comments:

Post a Comment