1. Login to the Primary Database (cdb)
[oracle@dbnode ~]$ export ORACLE_SID=cdb
[oracle@dbnode ~]$ export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome
[oracle@dbnode ~]$ cd /u01/app/oracle/product/12.1.0/dbhome/bin
[oracle@dbnode bin]$ ./sqlplus /nolog
SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 18 20:55:33 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> connect sys/oracle as sysdba
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 1386283008 bytes
Fixed Size 2288248 bytes
Variable Size 469763464 bytes
Database Buffers 905969664 bytes
Redo Buffers 8261632 bytes
Database mounted.
Database opened.
SQL> select con_id,name,open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
2 PDB$SEED READ ONLY
3 PDB1 MOUNTED
4 PDB2 MOUNTED
5 PDB3 MOUNTED
SQL> connect sys/oracle@192.168.56.111:1521/pdb1 as sysdba
Connected.
SQL> alter database open;
Database altered.
SQL> connect sys/oracle@192.168.56.111:1521/pdb2 as sysdba
Connected.
SQL> alter database open;
Database altered.
SQL> connect sys/oracle@192.168.56.111:1521/pdb3 as sysdba
Connected.
SQL> alter database open;
Database altered.
SQL> connect sys/oracle@192.168.56.111:1521/cdb as sysdba
Connected.
SQL> select con_id,name,open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
2 PDB$SEED READ ONLY
3 PDB1 READ WRITE
4 PDB2 READ WRITE
5 PDB3 READ WRITE
2. Login to the Pluggable Database (pdb1) in Primary Database (cdb) and create user and insert rows.
SQL> connect sys/oracle@192.168.56.111:1521/pdb1 as sysdba
Connected.
SQL> show con_name
CON_NAME
------------------------------
PDB1
SQL> create user user1 identified by user1;
User created.
SQL> grant connect,resource to user1;
Grant succeeded.
SQL> connect user1/user1@192.168.56.111:1521/pdb1
Connected.
SQL> create table user1_pdb1 (no number, name varchar2(20));
Table created.
SQL> insert into user1_pdb1 values (1, 'ORACLE');
1 row created.
SQL> commit;
Commit complete.
SQL> connect sys/oracle@192.168.56.111:1521/cdb as sysdba
Connected.
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
3. Login to the Physical Standby Database (cdbstby) and check Pluggable Database.
[oracle@dbnode ~]$ export ORACLE_SID=cdbstby
[oracle@dbnode ~]$ export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome
[oracle@dbnode ~]$ cd /u01/app/oracle/product/12.1.0/dbhome/bin
[oracle@dbnode bin]$ ./sqlplus /nolog
SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 18 20:56:39 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> connect sys/oracle as sysdba
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1386283008 bytes
Fixed Size 2288248 bytes
Variable Size 469763464 bytes
Database Buffers 905969664 bytes
Redo Buffers 8261632 bytes
Database mounted.
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect;
Database altered.
SQL> connect user1/user1@192.168.56.111:1521/pdb1
Connected.
SQL> select * from user1_pdb1;
NO NAME
---------- --------------------
1 ORACLE
Note: User1 created with user1_pdb1 table with inserted rows from Primary Database.
[oracle@dbnode ~]$ export ORACLE_SID=cdb
[oracle@dbnode ~]$ export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome
[oracle@dbnode ~]$ cd /u01/app/oracle/product/12.1.0/dbhome/bin
[oracle@dbnode bin]$ ./sqlplus /nolog
SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 18 20:55:33 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> connect sys/oracle as sysdba
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 1386283008 bytes
Fixed Size 2288248 bytes
Variable Size 469763464 bytes
Database Buffers 905969664 bytes
Redo Buffers 8261632 bytes
Database mounted.
Database opened.
SQL> select con_id,name,open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
2 PDB$SEED READ ONLY
3 PDB1 MOUNTED
4 PDB2 MOUNTED
5 PDB3 MOUNTED
SQL> connect sys/oracle@192.168.56.111:1521/pdb1 as sysdba
Connected.
SQL> alter database open;
Database altered.
SQL> connect sys/oracle@192.168.56.111:1521/pdb2 as sysdba
Connected.
SQL> alter database open;
Database altered.
SQL> connect sys/oracle@192.168.56.111:1521/pdb3 as sysdba
Connected.
SQL> alter database open;
Database altered.
SQL> connect sys/oracle@192.168.56.111:1521/cdb as sysdba
Connected.
SQL> select con_id,name,open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
2 PDB$SEED READ ONLY
3 PDB1 READ WRITE
4 PDB2 READ WRITE
5 PDB3 READ WRITE
2. Login to the Pluggable Database (pdb1) in Primary Database (cdb) and create user and insert rows.
SQL> connect sys/oracle@192.168.56.111:1521/pdb1 as sysdba
Connected.
SQL> show con_name
CON_NAME
------------------------------
PDB1
SQL> create user user1 identified by user1;
User created.
SQL> grant connect,resource to user1;
Grant succeeded.
SQL> connect user1/user1@192.168.56.111:1521/pdb1
Connected.
SQL> create table user1_pdb1 (no number, name varchar2(20));
Table created.
SQL> insert into user1_pdb1 values (1, 'ORACLE');
1 row created.
SQL> commit;
Commit complete.
SQL> connect sys/oracle@192.168.56.111:1521/cdb as sysdba
Connected.
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
3. Login to the Physical Standby Database (cdbstby) and check Pluggable Database.
[oracle@dbnode ~]$ export ORACLE_SID=cdbstby
[oracle@dbnode ~]$ export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome
[oracle@dbnode ~]$ cd /u01/app/oracle/product/12.1.0/dbhome/bin
[oracle@dbnode bin]$ ./sqlplus /nolog
SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 18 20:56:39 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> connect sys/oracle as sysdba
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1386283008 bytes
Fixed Size 2288248 bytes
Variable Size 469763464 bytes
Database Buffers 905969664 bytes
Redo Buffers 8261632 bytes
Database mounted.
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect;
Database altered.
SQL> connect user1/user1@192.168.56.111:1521/pdb1
Connected.
SQL> select * from user1_pdb1;
NO NAME
---------- --------------------
1 ORACLE
Note: User1 created with user1_pdb1 table with inserted rows from Primary Database.
No comments:
Post a Comment