2.oracle 12c Create-access-close-delete PDB

Source: Internet
Author: User

1. Create a PDBSql> select name from v$datafile;  NAME--------------------------------------------------------------------------------/u01/app/oracle/oradata/ ora12c/system01.dbf/u01/app/oracle/oradata/ora12c/pdbseed/system01.dbf/u01/app/oracle/oradata/ora12c/ sysaux01.dbf/u01/app/oracle/oradata/ora12c/pdbseed/sysaux01.dbf/u01/app/oracle/oradata/ora12c/undotbs01.dbf/ u01/app/oracle/oradata/ora12c/users01.dbf/u01/app/oracle/oradata/ora12c/emp/system01.dbf/u01/app/oracle/ Oradata/ora12c/emp/sysaux01.dbf/u01/app/oracle/oradata/ora12c/emp/emp_users01.dbf 9 rows selected. Sql> alter system set db_create_file_dest= '/U01/APP/ORACLE/ORADATA/ORA12C/DSG ';  system altered. sql > Create pluggable Database DSG Admin user hxy identified by Hxy roles= (connect),  pluggable database created. To set D first B_create_file_dest, otherwise create the PDB when the following error is reported:sql> create pluggable database DSG Admin user hxy identified by Hxy roles= (connect Create pluggable Database DSG Admin user hxy identified by Hxy roles= (connect)                                                                                  *error at line 1:ora-65016:file_name_convert must be specified view sql> select Con_id,name, Open_mode from v$pdbs;     con_id name                            Open_ MODE--------------------------------------------------         2 pdb$ seed                        READ only         3 EMP           & nbsp                    read write          4 DSG                             &NBSP ;  mounted start dsgsql> Alter pluggable database DSG open; Pluggable database altered. sql> Select Con_id,name,open_mode from v$pdbs;     con_id name                             Open_mode--------------------------------------------------          2 pdb$seed                        READ only          3 EMP                               &N Bsp READ write         4 DSG                 & nbsp              read write 2. (1) Accessing the PDB database through Tnsname Example: View the current database of pdbsql> select Con_id,name,open_mode from v$pdbs;    con_id name                             open_mode--------------------------------------------------          2 pdb$seed                       &NB Sp READ only         3 EMP                 &N Bsp               Read Write view tnsnames.oraemp =  (DESCRIPTION =    (ADD RESS = (PROTOCOL = TCP) (HOST = Localhost.localdomain) (PORT = 1521))     (Connect_data =   & nbsp;  (SERVER = dedicated)       (service_name = EMP)    )  )   Access: [[email protected] ~]$ sqlplus sys/[email proteCTED] as Sysdbasql*plus:release 12.1.0.1.0 Production on Sat Jan 14:26:04 2014Copyright (c) 1982, oracle.  All rights reserved. connected to:oracle Database 12c Enterprise Edition Release 12.1.0.1.0-64bit productionwith th E partitioning, OLAP, Advanced Analytics and Real application testing options sql> show Con_name con_idcon_name--- ---------------------------emp con_id------------------------------3  (2) Connect to the database using the Ezconnect methodSql> Conn Sys/[email PROTECTED]//LOCALHOST/DSG as sysdbaconnected. Sql> show Con_name con_id con_name------------------------------DSG con_id------------------------------ 4 viewsSql> select name from v$datafile;  NAME--------------------------------------------------------------------------------------------------------------------- ---/u01/app/oracle/oradata/ora12c/undotbs01.dbf/u01/app/oracle/oradata/ora12c/dsg/ora12c/ f039e431f9ce7170e0430100007f6a0d/datafile/o1_mf_system_9fn895qv_.dbf/u01/app/oracle/oradata/ora12c/dsg/ora12c/ The F039E431F9CE7170E0430100007F6A0D/DATAFILE/O1_MF_SYSAUX_9FN89MPK_.DBF has two separate data files system, Sysaux and shared undo table space shared Global data files sql> select name from v$tempfile;  NAME--------------------------------------------------------------------------------------------------------------------- ---/u01/app/oracle/oradata/ora12c/dsg/ora12c/f039e431f9ce7170e0430100007f6a0d/datafile/o1_mf_temp_9fn8bxy4_. DBF has separate temporary files  SQL> select name from v$controlfile;  NAME--------------------------------------------------------------------------------------------------------------------- ---/u01/app/oracle/oradata/ora12c/control01.ctl/u01/app/oracle/fast_recovEry_area/ora12c/control02.ctl control files are shared   (3) under User with advanced privileges such as DBA, session-level container switching through the ALTER command to access objects under different containersSql> Conn/as sysdbaconnected.sql> alter session set CONTAINER=DSG; Session altered. Sql> show con_id con_namecon_id------------------------------4con_name------------------------------DSG sql> Alter session set CONTAINER=EMP; Session altered. Sql> show con_id con_namecon_id------------------------------3con_name------------------------------EMP Five, turn off the PDB (1) switch to PDBSql> alter session set CONTAINER=DSG; Session altered. Sql> show con_id con_namecon_id------------------------------4con_name------------------------------DSG sql> Shutdown immediatepluggable Database closed. (2) the user with the SYS permission executessql> alter pluggable database EMP close; Pluggable Database altered.  Six, delete pdbsql> select Con_id,name,open_mode from v$pdbs;     con _id name                            Open_mode----------------------------------------------- ---         2 pdb$seed                        READ only          3 emp                             mounted          4 dsg                             READ write sql> Drop pluggable database DSG including Datafiles;drop pluggable Database DSG including Datafiles*error at line 1:ora-65025:pluggable database DSG are not closed on all instances. PDB must be turned off in order to remove PDBsql> Alter pluggable database DSG close; Pluggable database altered. sql> Drop pluggable database DSG including datafiles; Pluggable database dropped. To view the generated alert log: Delete all the corresponding data files in the OS view:
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.