Anda di halaman 1dari 7

Taller

ASM, RMAN, Data Guard


Monitoreo
[oracle@svrdbcon ~]$ sqlplus / as sysdba
## SQL> startup mount
[oracle@svrdbcon ~]$ sqlplus / as sysdba
SQL>
SELECT THREAD#,SEQUENCE#,PROCESS,CLIENT_PROCESS,STATUS,BLOCKS
FROM V$MANAGED_STANDBY;
2
THREAD# SEQUENCE# PROCESS
CLIENT_P STATUS
BLOCKS
---------- ---------- --------- -------- ------------ ---------0
0 ARCH
ARCH
CONNECTED
0
0
0 ARCH
ARCH
CONNECTED
0
0
0 ARCH
ARCH
CONNECTED
0
1
11 ARCH
ARCH
CLOSING
304
0
0 ARCH
ARCH
CONNECTED
0
0
0 RFS
ARCH
IDLE
0
0
0 RFS
UNKNOWN IDLE
0
0
0 RFS
UNKNOWN IDLE
0
1
12 RFS
LGWR
IDLE
1
SQL> shutdown immediate
SQL> startup mount
SQL>
SELECT THREAD#,SEQUENCE#,PROCESS,CLIENT_PROCESS,STATUS,BLOCKS
FROM V$MANAGED_STANDBY;
2
THREAD# SEQUENCE# PROCESS
CLIENT_P STATUS
BLOCKS
---------- ---------- --------- -------- ------------ ---------0
0 ARCH
ARCH
CONNECTED
0
0
0 ARCH
ARCH
CONNECTED
0
0
0 ARCH
ARCH
CONNECTED
0
0
0 ARCH
ARCH
CONNECTED
0
0
0 ARCH
ARCH
CONNECTED
0
0
0 RFS
ARCH
IDLE
0
SQL>
alter database recover managed standby database disconnect
from session;
SQL> archive log list
Database log mode
Automatic archival
Archive destination
Oldest online log sequence
Next log sequence to archive
Current log sequence

Archive Mode
Enabled
/u02/app/oracle/archive/
11
0
13

SQL>
SELECT THREAD#,SEQUENCE#,PROCESS,CLIENT_PROCESS,STATUS,BLOCKS
FROM V$MANAGED_STANDBY;
THREAD# SEQUENCE# PROCESS
CLIENT_P STATUS
BLOCKS
---------- ---------- --------- -------- ------------ ----------

0
1
0
0
0
0
0
1
1

0
12
0
0
0
0
0
13
13

ARCH
ARCH
ARCH
ARCH
ARCH
RFS
RFS
RFS
MRP0

ARCH
ARCH
ARCH
ARCH
ARCH
ARCH
UNKNOWN
LGWR
N/A

CONNECTED
CLOSING
CONNECTED
CONNECTED
CONNECTED
IDLE
IDLE
IDLE
WAIT_FOR_LOG

0
1018
0
0
0
0
0
1
0

SQL> shutdown immediate


SQL> startup nomount
SQL> select open_mode, database_role from v$database;
OPEN_MODE
DATABASE_ROLE
-------------------- ---------------MOUNTED
PHYSICAL STANDBY

SQL>
SELECT THREAD#, SEQUENCE#, PROCESS, CLIENT_PROCESS, STATUS, BLOCKS
FROM V$MANAGED_STANDBY;
2
THREAD# SEQUENCE# PROCESS
CLIENT_P STATUS
BLOCKS
---------- ---------- --------- -------- ------------ ---------0
0 ARCH
ARCH
CONNECTED
0
0
0 ARCH
ARCH
CONNECTED
0
0
0 ARCH
ARCH
CONNECTED
0
1
14 ARCH
ARCH
CLOSING
57
0
0 ARCH
ARCH
CONNECTED
0
0
0 RFS
ARCH
IDLE
0
0
0 RFS
UNKNOWN IDLE
0
1
15 RFS
LGWR
IDLE
1

Nota:
Status: CLOSING, IDLE
SQL> archive log list
Database log mode
Automatic archival
Archive destination
Oldest online log sequence
Next log sequence to archive
Current log sequence

Archive Mode
Enabled
/u02/app/oracle/archive/
13
0
15

SQL>
alter database recover managed standby database disconnect
from session;
SQL>
SELECT THREAD#, SEQUENCE#, PROCESS, CLIENT_PROCESS, STATUS, BLOCKS
FROM V$MANAGED_STANDBY;
THREAD# SEQUENCE# PROCESS
---------- ---------- --------0
0 ARCH
0
0 ARCH
0
0 ARCH
1
14 ARCH
0
0 ARCH
0
0 RFS
0
0 RFS
1
15 RFS
1
15 MRP0

CLIENT_P
-------ARCH
ARCH
ARCH
ARCH
ARCH
ARCH
UNKNOWN
LGWR
N/A

STATUS
BLOCKS
------------ ---------CONNECTED
0
CONNECTED
0
CONNECTED
0
CLOSING
57
CONNECTED
0
IDLE
0
IDLE
0
IDLE
1
WAIT_FOR_LOG
0

Media Recover Process (MRP)


[oracle@svrdbcon ~]$ ps -ef | grep mrp
oracle

11181

0 21:09 ?

00:00:00 ora_mrp0_cont

[oracle@svrdbcon ~]$ sqlplus / as sysdba


SQL> select program from v$session where program like '%MRP%';
PROGRAM
-----------------------------------------------oracle@svrdbcon.oracle.com (MRP0)

Stop Redo Apply.


[oracle@svrdbcon ~]$ sqlplus / as sysdba
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
SQL>
SELECT THREAD#,SEQUENCE#,PROCESS,CLIENT_PROCESS,STATUS,BLOCKS
FROM V$MANAGED_STANDBY;
THREAD# SEQUENCE# PROCESS
---------- ---------- --------0
0 ARCH
0
0 ARCH
0
0 ARCH
0
0 ARCH
1
14 ARCH
0
0 RFS
1
15 RFS
0
0 RFS

CLIENT_P
-------ARCH
ARCH
ARCH
ARCH
ARCH
ARCH
LGWR
UNKNOWN

STATUS
BLOCKS
------------ ---------CONNECTED
0
CONNECTED
0
CONNECTED
0
CONNECTED
0
CLOSING
1140
IDLE
0
IDLE
1
IDLE
0

SQL> select program from v$session where program like '%MRP%';


no rows selected

Start real-time apply.

SQL>
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT
LOGFILE DISCONNECT FROM SESSION;
SQL>
SELECT THREAD#,SEQUENCE#,PROCESS,CLIENT_PROCESS,STATUS,BLOCKS
FROM V$MANAGED_STANDBY;
2
THREAD# SEQUENCE# PROCESS
CLIENT_P STATUS
BLOCKS
---------- ---------- --------- -------- ------------ ---------0
0 ARCH
ARCH
CONNECTED
0
0
0 ARCH
ARCH
CONNECTED
0
0
0 ARCH
ARCH
CONNECTED
0
1
14 ARCH
ARCH
CLOSING
57
0
0 ARCH
ARCH
CONNECTED
0
0
0 RFS
ARCH
IDLE
0
0
0 RFS
UNKNOWN IDLE
0
1
15 RFS
LGWR
IDLE
1
1
15 MRP0
N/A
APPLYING_LOG
102400
9 rows selected.

Verificacin de la sincronizacin entre ambas bases de datos


Desde el servidor prod:
SQL>
SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG;
MAX(SEQUENCE#)
-------------14
SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG WHERE
APPLIED='YES';
MAX(SEQUENCE#)
-------------14
SQL>
SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG where STANDBY_DEST='YES' ORDER BY
SEQUENCE#;
SEQUENCE#
---------10
11
12
13
14

APPLIED
--------YES
YES
YES
YES
YES

Prueba:
SQL> SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG;
MAX(SEQUENCE#)
-------------14

SQL> alter system switch logfile;


SQL> SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG;
MAX(SEQUENCE#)
-------------15
SQL>
SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG where STANDBY_DEST='YES' ORDER BY
SEQUENCE#;
SEQUENCE#
---------9
10
11
12
13
14
15

APPLIED
--------YES
YES
YES
YES
YES
YES
NO

7 rows selected.
SQL>
Desde el servidor cont:
SQL>
SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE#
---------10
11
12
13
14
15

APPLIED
--------YES
YES
YES
YES
YES
IN-MEMORY

6 rows selected.
SQL>
Primary:
SQL> show parameter log_archive_dest_2
NAME
TYPE
VALUE
------------------------ ----------- -------------------------log_archive_dest_2
string
SERVICE=cont LGWR ASYNC VALID_FOR
=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=cont
Standby:
SQL>
SELECT THREAD#,SEQUENCE#,PROCESS,CLIENT_PROCESS,STATUS,BLOCK#,BLOCKS FROM
V$MANAGED_STANDBY;
THREAD# SEQUENCE# PROCESS
---------- ---------- --------0
0 ARCH
0
0 ARCH
1
15 ARCH

CLIENT_P
-------ARCH
ARCH
ARCH

STATUS
BLOCK#
BLOCKS
------------ ---------- ---------CONNECTED
0
0
CONNECTED
0
0
CLOSING
1
1723

0
1
0
1
0
1

0
14
0
16
0
16

ARCH
ARCH
RFS
RFS
RFS
MRP0

ARCH
ARCH
ARCH
LGWR
UNKNOWN
N/A

CONNECTED
CLOSING
IDLE
IDLE
IDLE
APPLYING_LOG

0
32768
0
516
0
516

0
1140
0
1
0
102400

9 rows selected.

Prueba 2:
Prod:
SQL> create table emp as select * from scott.emp;

En ambos ejecutar:
Prod:
SQL>
SELECT THREAD#,SEQUENCE#,PROCESS,CLIENT_PROCESS,STATUS,BLOCK#,BLOCKS FROM
V$MANAGED_STANDBY;
THREAD# SEQUENCE# PROCESS
---------- ---------- --------1
15 ARCH
0
0 ARCH
1
14 ARCH
1
14 ARCH
1
16 LNS

CLIENT_P
-------ARCH
ARCH
ARCH
ARCH
LNS

STATUS
BLOCK#
BLOCKS
------------ ---------- ---------CLOSING
1
1574
CONNECTED
0
0
CLOSING
1
57
CLOSING
2
56
WRITING
299
1

Cont:
SQL>
SELECT THREAD#,SEQUENCE#,PROCESS,CLIENT_PROCESS,STATUS,BLOCK#,BLOCKS FROM
V$MANAGED_STANDBY;
THREAD# SEQUENCE# PROCESS
---------- ---------- --------0
0 ARCH
0
0 ARCH
1
15 ARCH
0
0 ARCH
1
14 ARCH
0
0 RFS
1
16 RFS
0
0 RFS
1
16 MRP0

CLIENT_P
-------ARCH
ARCH
ARCH
ARCH
ARCH
ARCH
LGWR
UNKNOWN
N/A

STATUS
BLOCK#
BLOCKS
------------ ---------- ---------CONNECTED
0
0
CONNECTED
0
0
CLOSING
1
1723
CONNECTED
0
0
CLOSING
32768
1140
IDLE
0
0
IDLE
853
7
IDLE
0
0
APPLYING_LOG
859
102400

Validaciones adicionales:
Cont:
SQL>
SELECT name, value, datum_time, time_computed FROM
V$DATAGUARD_STATS WHERE name like 'apply lag';
NAME
-------------------------------VALUE
---------------------------------------------------------------DATUM_TIME
TIME_COMPUTED

------------------------------ -----------------------------apply lag


+00 00:00:03
12/25/2015 21:23:40
12/25/2015 21:23:41