Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [oracle@waipio1 POLOLU pdbcreate]$ sqlplus / as sysdba
- SQL*Plus: Release 12.1.0.1.0 Production on Thu Oct 3 05:47:55 2013
- Copyright (c) 1982, 2013, Oracle. All rights reserved.
- Connected to an idle instance.
- SQL> startup mount
- ORACLE instance started.
- Total System Global Area 2505338880 bytes
- Fixed Size 2684688 bytes
- Variable Size 721422576 bytes
- Database Buffers 1761607680 bytes
- Redo Buffers 19623936 bytes
- Database mounted.
- SQL> alter database open read only;
- Database altered.
- [oracle@waipio1 pdbcreate]$ cat pdbdescribe.sql
- @ abortIfNotReadOnly.sql
- column db_name new_value db_name format a8
- select sys_context ( 'userenv', 'db_name' ) db_name from dual;
- define xmlfile=/home/oracle/sql/multitenant/pdbcreate/pdb.&&db_name..xml
- begin
- dbms_pdb.describe(
- pdb_descr_file => '/home/oracle/sql/multitenant/pdbcreate/pdb.&&db_name..xml'
- );
- end;
- /
- [oracle@waipio1 pdbcreate]$ cat abortIfNotReadOnly.sql
- whenever sqlerror exit 1
- select to_number ( 'NaN' ) from v$database where open_mode != 'READ ONLY';
- prompt Database is open READ ONLY
- [oracle@waipio1 POLOLU pdbcreate]$ sqlplus / as sysdba @ pdbdescribe.sql
- SQL*Plus: Release 12.1.0.1.0 Production on Thu Oct 3 05:55:38 2013
- Copyright (c) 1982, 2013, Oracle. All rights reserved.
- Connected to:
- Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
- With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
- and Real Application Testing options
- no rows selected
- Database is open READ ONLY
- DB_NAME
- --------
- POLOLU
- old 3: pdb_descr_file => '/home/oracle/sql/multitenant/pdbcreate/pdb.&&db_name..xml'
- new 3: pdb_descr_file => '/home/oracle/sql/multitenant/pdbcreate/pdb.POLOLU.xml'
- PL/SQL procedure successfully completed.
- SQL> shutdown immediate
- Database closed.
- Database dismounted.
- ORACLE instance shut down.
- [oracle@waipio1 KILAUEA pdbcreate]$ cat createpdb.nocopyunplugged.sql
- create pluggable database &&1
- using '&&2' nocopy
- ;
- quit
- [oracle@waipio1 POLOLU pdbcreate]$ sqlplus sys/sys.n1te@kilauea as sysdba @ createpdb.nocopyunplugged.sql POLOLU '/home/oracle/sql/multitenant/pdbcreate/pdb.POLOLU.xml'
- SQL*Plus: Release 12.1.0.1.0 Production on Thu Oct 3 06:04:42 2013
- Copyright (c) 1982, 2013, Oracle. All rights reserved.
- Connected to:
- Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
- With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
- and Real Application Testing options
- old 1: create pluggable database &&1
- new 1: create pluggable database POLOLU
- old 2: using '&&2' nocopy
- new 2: using '/home/oracle/sql/multitenant/pdbcreate/pdb.POLOLU.xml' nocopy
- Pluggable database created.
- Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
- With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
- and Real Application Testing options
- [oracle@waipio1 POLOLU pdbcreate]$ cat noncdb.to.cdb.sql
- alter session set container = &&1;
- column containername new_value containername
- select sys_context( 'userenv', 'con_name' ) containername from dual;
- spool noncdb_to_pdb.&&containername..txt
- @ ?/rdbms/admin/noncdb_to_pdb.sql
- quit
- [oracle@waipio1 POLOLU pdbcreate]$ sqlplus sys/sys.n1te@kilauea as sysdba @ noncdb.to.cdb.sql POLOLU
- SQL*Plus: Release 12.1.0.1.0 Production on Thu Oct 3 06:07:51 2013
- Copyright (c) 1982, 2013, Oracle. All rights reserved.
- Connected to:
- Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
- With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
- and Real Application Testing options
- old 1: alter session set container = &&1
- new 1: alter session set container = POLOLU
- Session altered.
- CONTAINERNAME
- --------------------------------------------------------------------------------
- POLOLU
- refer to
- http://pastebin.com/mXd776Bc
- for the full output
- [oracle@waipio1 POLOLU pdbcreate]$ sqlplus sys/sys.n1te@kilauea as sysdba @ alterpdbopen.sql POLOLU
- SQL*Plus: Release 12.1.0.1.0 Production on Thu Oct 3 06:54:05 2013
- Copyright (c) 1982, 2013, Oracle. All rights reserved.
- Connected to:
- Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
- With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
- and Real Application Testing options
- old 1: alter pluggable database &&1 open
- new 1: alter pluggable database POLOLU open
- Warning: PDB altered with errors.
- =============================
- cleanup file locations
- SQL> select file# from v$datafile where name like '+DATA/POLOLU/DATAFILE%';
- FILE#
- ----------
- 63
- 64
- 65
- 66
- SQL> alter database move datafile 63 to '+DATA';
- Database altered.
- SQL> alter database move datafile 64 to '+DATA';
- Database altered.
- SQL> alter database move datafile 65 to '+DATA';
- Database altered.
- SQL> alter database move datafile 66 to '+DATA';
- Database altered.
- SQL> select file# from v$datafile where name like '+DATA/POLOLU/DATAFILE%';
- no rows selected
- SQL> select name from v$datafile;
- NAME
- --------------------------------------------------------------------------------
- +DATA/KILAUEA/DATAFILE/undotbs1.332.824921837
- +DATA/KILAUEA/E6290320C01779F4E0437901A8C0A488/DATAFILE/system.351.827825773
- +DATA/KILAUEA/E6290320C01779F4E0437901A8C0A488/DATAFILE/sysaux.583.827826199
- +DATA/KILAUEA/E6290320C01779F4E0437901A8C0A488/DATAFILE/users.580.827826371
- +DATA/KILAUEA/E6290320C01779F4E0437901A8C0A488/DATAFILE/hexts.584.827826387
- SQL>
Advertisement
Add Comment
Please, Sign In to add comment