1. How do I know if a 12c db is a container database?
(1) Container DB
Sql> Select CDB from V$database;
CDB
---
YES
(2) Non container DB
Sql> Select CDB from V$database;
CDB
---
NO
2. How do I view all the PDB?
Sql> select Name, Open_mode from V$pdbs;
NAME Open_mode
------------------------------ ----------
Pdb$seed READ only <===== the is a SEED PDB
PDBORCL mounted <===== This is a PDB at Mount status
PDB1 READ WRITE <===== This was a PDB at Read/write open status
3. How do I open a PDB?
Sql> Show Con_name
Con_name
------------------------------
Cdb$root
Sql> alter session set CONTAINER=PDBORCL;
Session altered.
Sql> Show Con_name <==== View current DB session
Con_name
------------------------------
Pdborcl
sql> ALTER DATABASE PDBORCL open;
Database altered.
Sql> select Name, Open_mode from V$pdbs;
NAME Open_mode
------------------------------ ----------
PDBORCL READ WRITE
4. How do I list all the PDB (including CDB) on the service?
(1) in the CDB root session
Sql> Connect/as SYSDBA
Connected.
Sql> select name,con_id,pdb from V$services;
NAME con_id PDB
----------------------------------- ---------- ------------------------------
PDB1 4 PDB1
PDBORCL 3 PDBORCL
Orclxdb 1 Cdb$root
ORCL 1 Cdb$root
Sys$background 1 Cdb$root
Sys$users 1 Cdb$root
(Note: read-only pdb$seed not listed here)
(2) in the PDB session
Sql> alter session set CONTAINER=PDBORCL;
Session altered.
Sql> select name,con_id,pdb from V$services;
NAME con_id PDB
----------------------------------- ---------- ------------------------------
PDBORCL 3 PDBORCL
5. How to connect directly to a PDB instead of ' alter session set container '?
[Email protected] ~]$ sqlplus Pdb1_u1/[email protected]
Sql*plus:release 12.1.0.1.0 Production on Thu Dec 19 12:03:14 2013
Copyright (c) 1982, Oracle. All rights reserved.
Last successful login Time:thu Dec 19 2013 12:02:49-08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0-64bit Production
With the partitioning, OLAP, Advanced Analytics and Real application testing options
Sql> Show Con_name
Con_name
------------------------------
PDB1
6. How do I create a CDB user for Ogg extract?
Sql> Connect/as SYSDBA
Connected.
sql> Create User C # #GGADMIN identified by Ggadmin;
User created.
sql> exec Dbms_goldengate_auth.grant_admin_privilege (' C # #GGADMIN ',container=> ' all ');
PL/SQL procedure successfully completed.
Sql> Grant DBA to C # #ggadmin Container=all;
Grant succeeded.
Note: Passwords may be case sensitive:
Sql> Connect C # #GGADMIN/ggadmin
ERROR:
Ora-01017:invalid Username/password; Logon denied
Sql> Connect C # #GGADMIN/ggadmin
Connected.
Sql> Connect C # #ggadmin/ggadmin
Connected.
Therefore, in the Extract/replicat parameter file, the case of the password should also be the same.
For example, UserID C # #ggadmin, password ggadmin
7. Here is a extract example and a simple test
(1) Parameter file
Extract E1
UserID C # #ggadmin, password ggadmin
Exttrail./dirdat/e1
DDL include mapped
Ddloptions Report
Sequence pdb1.pdb1_u1.*;
Table pdborcl.pdborcl_u1.*;
Table pdb1.pdb1_u1.s1;
(2) configuration (can only use integrated extraction data in CDB)
Ggsci 31> dblogin userid C # #ggadmin, password ggadmin
Successfully logged into database Cdb$root.
Ggsci 32> Add extract e1, integrated Tranlog, begin now
EXTRACT added.
Ggsci 33> add Exttrail./dirdat/e1, extract E1
Exttrail added.
Ggsci 37> REGISTER EXTRACT E1 DATABASE CONTAINER (PDBORCL, PDB1)
Extract E1 successfully registered with database at SCN 2664333.
Sql> select Capture_name,capture_user,status,start_scn,purpose from Dba_capture;
Capture_name capture_user STATUS START_SCN PURPOSE
----------------- ------------------ -------- ---------- -------------------
Ogg$cap_e1 C # #GGADMIN ENABLED 2664333 GoldenGate Capture
(3) test
Sql> Connect Pdb1_u1/[email protected]
Connected.
1) DML
sql> INSERT into S1 values (+);
1 row created.
Sql> commit;
Commit complete.
2) DDL
sql> Create sequence SS1;
Sequence created.
3) Sequence
Sql> select Ss1.nextval from dual;
Nextval
----------
1
Sql> select Ss1.nextval from dual;
Nextval
----------
2
Ggsci> Send E1 report
From report file
....
From Table PDB1. Pdb1_u1. S1:
# inserts:1
# updates:0
# deletes:0
# discards:0
From Sequence PDB1. Pdb1_u1. SS1:
# updates:1
# discards:0
DDL Replication Statistics:
Operations:1
Mapped operations:1
Unmapped operations:0
Other operations:0
Excluded operations:0
8. Replicat in Ogg user can connect to CDB root no?
No, Replicat. The Ogg delivery user is allowed to connect to only one PDB.
such as: userid [email protected], password PDB1_U1
9. How to copy sequence to the target side?
Need to execute at both ends: Sequence.sql, specific steps can be referenced in the Ogg for Oracle.pdf document <installing support for Oracle Sequences>
Some questions and answers from Oracle 12c and Goldengate 12c