In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is to share with you about how to use Non-CDB to create PDB in Oracle 12c. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.
You can move the Non-CDB to become a PDB. You can accomplish this task in the following ways:
. Create a PDB by cloning Non-CDB. Starting with Oracle 12.1.0.2, you can create a PDB by cloning Non-CDB. This is the easiest way to create a PDB, but it requires copying files from Non-CDB to a new directory.
. Use the dbms_pdb package to generate Non-CDB metadata files, and the data files used to describe XML can be used to attach them to CDB. This method takes more steps than cloning Non-CDB, but it allows you to create a PDB without moving Non-CDB files. In order to use this technology, Non-CDB must be the Non-CDB of Oracle 12C. If the current Non-CDB uses a version prior to Oracle 12C, then you must upgrade Non-CDB to Oracle 12C.
. Export / Import using Oracle Data Pump
You can use Data Pump to export data from Non-CDB and import it into PDB. When you perform an import, specify the connection identifier of the PDB after the user name. For example, if the connection identifier for PDB is hrpdb, execute the following command during the import:
Imdp username@hrpdb.... If the version of Non-CDB is 11.2.0.3 or later, you can use full transfer export / import to move data. When you migrate an 11g version of Non-CDB with version 11.2.0.3 or later to Oracle 12C, you need to set the version parameter to 12.0.0.0.0 or later when exporting. If the version of Non-CDB is prior to 11.2.0.3, you can use the transport tablespace to move the data or perform a full database export\ import.
. Copy using goldengate
You can use goldengate to copy data from Non-CDB to PDB.
Execute the dbms_ PDB package for Non-CDB
You can use the dbms_pdb package to generate an XML metadata file for Non-CDB to attach to CDB. To move Non-CDB to PDB using the dbms_pdb package is as follows:
1. If CDB does not exist, create CDB first
two。 Make sure that Non-CDB is in a transaction-consistent state and make it read-only
[oracle@jytest1] $export ORACLE_SID= orcl1 [Oracle @ jytest1] $sqlplus / as sysdbaSQL*Plus: Release 12.2.0.1.0 Production on Thu Sep 7 00:38:31 2017Copyright (c) 1982, 2016, Oracle. All rights reserved.Connected to an idle instance.SQL > startup mountORACLE instance started.Total System Global Area 4294967296 bytesFixed Size 8628936 bytesVariable Size 2583692600 bytesDatabase Buffers 1694498816 bytesRedo Buffers 8146944 bytesDatabase mounted.SQL > alter database open read only;Database altered. [oracle@jytest2] $export ORACLE_SID= orcl2 [oracle @ jytest2] $sqlplus / as sysdbaSQL*Plus: Release 12.2.0.1.0 Production on Thu Sep 7 00:38:31 2017Copyright (c) 1982,2016, Oracle. All rights reserved.Connected to an idle instance.SQL > startup mountORACLE instance started.Total System Global Area 4294967296 bytesFixed Size 8628936 bytesVariable Size 2583692600 bytesDatabase Buffers 1694498816 bytesRedo Buffers 8146944 bytesDatabase mounted.SQL > alter database open read only;Database altered.
3. Connect to the Non-CDB and perform the dbms_pdb.describe process to create an Non-CDB metadata file that describes XML. The user who performs this procedure must have sysdba privileges.
SQL > exec dbms_pdb.describe (pdb_descr_file= >'/ cdb_pdb/orcl.xml'); PL/SQL procedure successfully completed. [oracle@jytest2 cdb_pdb] $ls-lrttotal 8 RW Ruki Ruki-1 oracle asmadmin 6963 Sep 7 00:18 orcl.xml
4. Execute the dbms_pdb.check_plug_compatibility process to determine whether the Non-CDB is compatible with the target CDB. Set the following parameters when performing this procedure:
-pdb_descr_file: sets the full path to the XML metadata file.
-pdb_name: specify the new PDB name, and if this parameter is ignored, the PDB name in the XML metadata file will be used.
SQL > set serveroutput on 1 declare 2 compatible constant varchar2 (3): = 3 case dbms_pdb.check_plug_compatibility (4 pdb_descr_file = >'/ cdb_pdb/orcl.xml', 5 pdb_name = > 'orclpdb') 6 when true then' yes' 7 else 'no' 8 end; 9 begin 10 dbms_output.put_line (compatible) 11 end; 12 / yesPL/SQL procedure successfully completed.
If the output is yes, then Non-CDB is compatible and you can proceed to the next step. If the output is no, then Non-CDB is not compatible with the target CDB, and you can check the pdb_plug_in_violations view to see why. All violations must be fixed before continuing. For example, any version or patch mismatch can be resolved by performing an upgrade or patching. After fixing the violation, execute dbms_pdb.check_plug_compatibility again to ensure that Non-CDB is compatible with the target CDB.
5. Close Non-CDB
[grid@jytest1 ~] $srvctl stop database-db orcl
6. Insert Non-CDB
SQL > create pluggable database orclpdb using'/ cdb_pdb/orcl.xml' 2 copy 3 file_name_convert = ('+ DATA/orcl/datafile/','+ data/jy/orclpdb/','+DATA/orcl/tempfile/','+data/jy/orclpdb/'); Pluggable database created.SQL > select name,open_mode from v$pdbs NAME OPEN_MODE -PDB$SEED READ ONLYJYPDB READ WRITEORCLPDB MOUNTEDASMCMD [+ data/jy/orclpdb] > ls-ltType Redund Striped Time Sys NameDATAFILE UNPROT COARSE SEP 07 00:00:00 N usertbs01.dbf = > + DATA/jy/4D913A1436E25EE2E053AB828A0AF7B8/DATAFILE/USERTBS.278.954031319DATAFILE UNPROT COARSE SEP 07 00:00:00 N users01.dbf = > + DATA/jy/4D913A1436E25EE2E053AB828A0AF7B8/DATAFILE/USERS.302.954031321DATAFILE UNPROT COARSE SEP 07 00 : 00:00 N undotbs01.dbf = > + DATA/jy/4D913A1436E25EE2E053AB828A0AF7B8/DATAFILE/UNDOTBS1.273.954031321TEMPFILE UNPROT COARSE SEP 07 00:00:00 N temp01.dbf = > + DATA/jy/4D913A1436E25EE2E053AB828A0AF7B8/TEMPFILE/TEMPTS1.315.954031465DATAFILE UNPROT COARSE SEP 07 00:00:00 N system01.dbf = > + DATA/jy/4D913A1436E25EE2E053AB828A0AF7B8/DATAFILE/SYSTEM.303.954031321DATAFILE UNPROT COARSE SEP 07 00:00:00 N sysaux01.dbf = > + DATA/jy/4D913A1436E25EE2E053AB828A0AF7B8/DATAFILE/SYSAUX.295.954031321
If there are no errors here, do not open the new PDB now.
7. Execute the $ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql script, which must be executed before opening the new PDB for the first time. If PDB is not created by Non-CDB, you don't need to execute this script. To execute the noncdb_to_pdb.sql script, complete the following:
a. To access PDB, the current user must have sysdba permission, and the permission must be public or locally granted to PDB. It is best to use as sysdba to connect.
b. Execute the noncdb_to_pdb.sql script:
SQL > @ $ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
8. Open a new PDB in read-write mode
SQL > alter pluggable database orclpdb open read write;Pluggable database altered.SQL > select name,open_mode from v$pdbs NAME OPEN_MODE -PDB$SEED READ ONLYJYPDB READ WRITEORCLPDB READ WRITE above is how to use Non-CDB to create PDB in Oracle 12c The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.