Primeiramente devo lembrar que o ideal é que seu catálogo de recuperação não fique no mesmo servidor que está sua database de produção, mas para este exemplo utilizaremos o mesmo servidor.
Inicialmente considero que sua instância esteja ativa com uma database ou mais em status 'OPEN'. Não vou comentar parâmetros de memória de SGA e etc, isso você terá de ajustar se necessário, bem como os paths de sua instância. Então é um passo a passo mesmo:
1 - Crie a estrutura que armazenará os arquivos da database de catálogo:
$ mkdir -p /u01/RMAN/DBA
2 - Crie o arquivo 'vim /u01/RMAN/DBA/create_db_rman.sql' e coloque no mesmo o seguinte conteúdo:
CREATE DATABASE RMAN
LOGFILE GROUP 1 ('/u01/RMAN/log/redo1.log') SIZE 100M,
GROUP 2 ('/u01/RMAN/log/redo2.log') SIZE 100M,
GROUP 3 ('/u01/RMAN/log/redo3.log') SIZE 100M
NOARCHIVELOG
CHARACTER SET WE8ISO8859P1
NATIONAL CHARACTER SET utf8
DATAFILE '/u01/RMAN/dbf/system.dbf'
SIZE 300M
AUTOEXTEND ON
NEXT 100M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/RMAN/dbf/sysaux.dbf'
SIZE 200M
AUTOEXTEND ON
NEXT 10M
MAXSIZE 501m
UNDO TABLESPACE UNDO
DATAFILE '/u01/RMAN/dbf/undo1.dbf'
SIZE 200M
DEFAULT TEMPORARY TABLESPACE TEMP
TEMPFILE '/u01/RMAN/dbf/temp1.dbf'
SIZE 500M;
3 - Acesse o diretório 'cd $ORACLE_HOME/dbs' e crie o seguinte arquivo 'initRMAN.ora' com o conteúdo abaixo:
#####################################################
# Paramenters Instance RMAN #
# Author : Rodrigo Almeida #
# Date: 25/10/2006 #
# Version : 1.0 #
#####################################################
####################################################
# Audit Parameters #
####################################################
AUDIT_FILE_DEST = '/u01/oracle/product/10.2.0/db_1/admin/RMAN/adump'
####################################################
# Database Parameters #
####################################################
BACKGROUND_DUMP_DEST = '/u01/oracle/product/10.2.0/db_1/admin/RMAN/bdump'
DB_16k_cache_size = 1047600
DB_BLOCK_SIZE = 8192
DB_CACHE_SIZE = 2624000
DB_DOMAIN = ''
DB_FILE_MULTIBLOCK_READ_COUNT = 16721600
DB_NAME = RMAN
DB_WRITER_PROCESSES = 2
GLOBAL_NAMES = FALSE
COMPATIBLE = 10.2.0.0.0
CONTROL_FILES = ('/u01/RMAN/ctl/control1.ctl','/u01/RMAN/ctl/control2.ctl','/u01/RMAN/ctl/control3.ctl')
CORE_DUMP_DEST = '/u01/oracle/product/10.2.0/db_1/admin/RMAN/cdump'
OPTIMIZER_MODE = ALL_ROWS
OPEN_CURSORS = 50
PROCESSES = 150
SESSIONS = 100
TRANSACTIONS = 112
USER_DUMP_DEST = '/u01/oracle/product/10.2.0/db_1/admin/RMAN/udump'
####################################################
# SGA Parameters #
####################################################
BITMAP_MERGE_AREA_SIZE = 0
CREATE_BITMAP_AREA_SIZE = 0
HASH_AREA_SIZE = 0
JAVA_POOL_SIZE = 0
LARGE_POOL_SIZE = 0
SHARED_POOL_RESERVED_SIZE = 0
SHARED_POOL_SIZE = 0
SORT_AREA_RETAINED_SIZE = 0
SORT_AREA_SIZE = 0
SGA_TARGET = 157286400
WORKAREA_SIZE_POLICY = MANUAL
####################################################
# Security Parameters #
####################################################
O7_DICTIONARY_ACCESSIBILITY = TRUE
OS_ROLES = FALSE
REMOTE_OS_ROLES = FALSE
SQL92_SECURITY = TRUE
####################################################
# LOG Parameters #
####################################################
LOG_ARCHIVE_DEST = '/u01/RMAN/arch'
LOG_ARCHIVE_FORMAT = 'RMAN_%s%r%t.arc'
LOG_ARCHIVE_MAX_PROCESSES = 2
LOG_CHECKPOINT_INTERVAL = 999999
####################################################
# Parallel Parameters #
####################################################
PARALLEL_MAX_SERVERS = 4
PARALLEL_MIN_SERVERS = 4
PARALLEL_THREADS_PER_CPU = 2
####################################################
# Undo Parameters #
####################################################
UNDO_MANAGEMENT = AUTO
UNDO_RETENTION = 900
UNDO_TABLESPACE = UNDO
####################################################
# Misc Parameters #
####################################################
UTL_FILE_DIR = '/u01/RMAN/utl'
JOB_QUEUE_PROCESSES = 10
QUERY_REWRITE_ENABLED = TRUE
RESOURCE_LIMIT = TRUE
STATISTICS_LEVEL = TYPICAL
4 - Crie os diretórios abaixo:
$ mkdir /u01/RMAN/utl
$ mkdir -p /u01/oracle/product/10.2.0/db_1/admin/RMAN/udump
$ mkdir -p /u01/oracle/product/10.2.0/db_1/admin/RMAN/cdump
$ mkdir -p /u01/RMAN/ctl
$ mkdir -p /u01/oracle/product/10.2.0/db_1/admin/RMAN/bdump
$ mkdir -p /u01/oracle/product/10.2.0/db_1/admin/RMAN/adump
5 - Altere o SID na variável do S.O. e conecte no SQLPlus:
$ export ORACLE_SID=RMAN
$ sqlplus "/ as sysdba"
6 - Inicie a instância Oracle:
SQL> startup nomount pfile=$ORACLE_HOME/dbs/initRMAN.ora
7 - Crie a database RMAN e crie o dicionário de dados da database:
SQL> @/u01/RMAN/DBA/create_db_rman.sql
SQL> @$ORACLE_HOME/rdbms/admin/catalog.sql
8 - Execute o script abaixo:
SQL> @$ORACLE_HOME/rdbms/admin/catproc.sql
9 - Verifique o status da database:
SQL> SELECT INSTANCE_NAME, STATUS FROM V$INSTANCE;
10 - Adicione a database no TNSNAMES e teste:
RMAN =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ip_do_meu_servidor)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RMAN)
)
)
$ tnsping RMAN
11 - Acesse o SQLPlus e conecte na database 'RMAN':
$ sqlplus "/ as sysdba"
SQL> connect sys AS SYSDBA
12 - Crie a tablespace 'RMAN' que será utilizada para o catálogo de recuperação, bem como o usuário 'rman' com as grants necessárias:
SQL> CREATE TABLESPACE RMAN
DATAFILE '/u01/RMAN/dbf/rman_01.dbf' SIZE 100M
PERMANENT ONLINE
EXTENT MANAGEMENT LOCAL
AUTOALLOCATE
SEGMENT SPACE MANAGEMENT AUTO;
SQL> CREATE USER RMAN
IDENTIFIED BY teste123
DEFAULT TABLESPACE RMAN
TEMPORARY TABLESPACE TEMP;
SQL> GRANT CONNECT, RESOURCE, RECOVERY_CATALOG_OWNER TO RMAN;
13 - Agora vamos criar o catálogo de recuperação no RMAN:
$ rman catalog 'rman/teste123@rman';
RMAN> create catalog tablespace "RMAN";
RMAN> exit
Finalizados os passos acima, basta acessar o EM e na guia 'Manutenção - Definições do catálogo de recuperação' adicionar os parâmetros de conexão da database que acabou de criar, assim o RMAN não utilizará mais os controlfiles, logo, se perdê-los existe salvação(desde que nos seus backups tenha copiado os controlfiles também).
Nenhum comentário:
Postar um comentário