Sunday, January 9, 2011

Active dataguard in 11gR2



SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production




SQL> startup mount
ORACLE instance started.

Total System Global Area 636100608 bytes
Fixed Size 1346048 bytes
Variable Size 398460416 bytes
Database Buffers 230686720 bytes
Redo Buffers 5607424 bytes
Database mounted.
SQL> select open_mode from v$database;

OPEN_MODE
--------------------
MOUNTED

SQL> alter database recover managed standby database using current logfile disconnect;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
MOUNTED

SQL> alter database recover managed standby database cancel;

Database altered.

SQL> alter database open;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY

SQL> alter database recover managed standby database using current logfile disconnect;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY WITH APPLY





SQL> col datum_time for a19
SQL> col time_computed for a19
SQL> col name for a22
SQL> col value for a15

SQL> select name,value,time_computed,datum_time from v$dataguard_stats;

NAME VALUE TIME_COMPUTED DATUM_TIME
---------------------- --------------- ------------------- -------------------
transport lag +00 00:00:00 01/09/2011 22:50:56 01/09/2011 22:50:55
apply lag +00 00:00:00 01/09/2011 22:50:56 01/09/2011 22:50:55
apply finish time 01/09/2011 22:50:56
estimated startup time 11 01/09/2011 22:50:56


SQL> select count(*) from tab;

COUNT(*)
----------
4716

SQL> create table t (id number);
create table t (id number)
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-16000: database open for read-only access


SQL> create global temporary table t(id number);
create global temporary table t(id number)
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-16000: database open for read-only access