|
1Z0-063第3/4章
1Z0-052共19章(上完19章),1Z0-053共21章(上完21章)和1Z0-063多租户部分共9章(上完4章)
总共上完全部49章中的44章
非容器变成插件以后文件系统或磁盘组上的清理(P77忽略的)
- [oracle@station26 admin]$ vim tnsnames.ora
- [oracle@station26 admin]$ cp tnsnames.ora /u01/app/oracle/product/12.1.0/grid/network/admin/
- [oracle@station26 admin]$ tnsping pdb_orcl2
- TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 27-DEC-2017 19:20:51
- Copyright (c) 1997, 2014, Oracle. All rights reserved.
- Used parameter files:
- Used TNSNAMES adapter to resolve the alias
- Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = station26.example.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pdb_orcl2)))
- OK (10 msec)
- [oracle@station26 admin]$ cd /u01/app/oracle/product/
- 12.1.0/ agent/
- [oracle@station26 admin]$ cd /u01/app/oracle/product/12.1.0/
- dbhome_1/ dbhome_2/ grid/
- [oracle@station26 admin]$ cd /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/
- [oracle@station26 admin]$ sqlplus sys/oracle_4U@pdb_orcl2 as sysdba
- SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 19:22:11 2017
- Copyright (c) 1982, 2014, Oracle. All rights reserved.
- Connected to:
- Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
- and Real Application Testing options
- SQL> select t.name , d.name ,t.con_id, d.status
- 2 from v$tablespace t, v$datafile d
- 3 where t.ts#=d.ts#
- 4 order by 1,2 ;
- SQL> set linesize 10000
- SQL> /
- NAME NAME CON_ID STATUS
- ------------------------------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------- -------
- EXAMPLE +DATA/ORCL2/DATAFILE/example.284.934891291 5 ONLINE
- SYSAUX +DATA/ORCL2/DATAFILE/sysaux.275.934891047 5 ONLINE
- SYSTEM +DATA/ORCL2/DATAFILE/system.276.934891113 5 SYSTEM
- UNDOTBS1 /u01/app/oracle/oradata/cdb2/undotbs01.dbf 0 ONLINE
- USERS +DATA/ORCL2/DATAFILE/users.277.934891199 5 ONLINE
- SQL> exit
- Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
- and Real Application Testing options
- [oracle@station26 admin]$ . oraenv
- ORACLE_SID = [cdb1] ? +ASM
- The Oracle base remains unchanged with value /u01/app/oracle
- [oracle@station26 admin]$ asmcmd
- ASMCMD> ls
- DATA/
- FRA/
- ASMCMD> cd DATA/
- ASMCMD> ls
- ASM/
- CDB1/
- CDB2/
- ORCL2/
- orapwasm
- ASMCMD> cd ORCL2/
- ASMCMD> ls
- CONTROLFILE/
- DATAFILE/
- ONLINELOG/
- PARAMETERFILE/
- ASMCMD> cd DATAFILE/
- ASMCMD> ls
- EXAMPLE.284.934891291
- SYSAUX.275.934891047
- SYSTEM.276.934891113
- UNDOTBS1.278.934891199
- USERS.277.934891199
- ASMCMD> rm UNDOTBS1.278.934891199
- ASMCMD> cd ..
- ASMCMD> ls
- CONTROLFILE/
- DATAFILE/
- ONLINELOG/
- PARAMETERFILE/
- ASMCMD> cd CONTROLFILE/
- ASMCMD> ls
- Current.279.934891255
- ASMCMD> cd ..
- ASMCMD> ls
- CONTROLFILE/
- DATAFILE/
- ONLINELOG/
- PARAMETERFILE/
- ASMCMD> cd ..
- ASMCMD> ls
- ASM/
- CDB1/
- CDB2/
- ORCL2/
- orapwasm
- ASMCMD> pwd
- +DATA
- ASMCMD> cd ORCL2/
- ASMCMD> ls
- CONTROLFILE/
- DATAFILE/
- ONLINELOG/
- PARAMETERFILE/
- ASMCMD> rm -r CONTROLFILE/
- You may delete multiple files and/or directories.
- Are you sure? (y/n) y
- ASMCMD> rm -f ONLINELOG/
- ORA-15032: not all alterations performed
- ORA-15177: cannot operate on system aliases (DBD ERROR: OCIStmtExecute)
- ASMCMD> ls
- DATAFILE/
- ONLINELOG/
- PARAMETERFILE/
- ASMCMD> cd ONLINELOG/
- ASMCMD> ls
- group_1.280.934891259
- group_2.281.934891263
- group_3.282.934891267
- ASMCMD> rm *
- You may delete multiple files and/or directories.
- Are you sure? (y/n) y
- ASMCMD> cd ..
- ASMCMD> ls
- DATAFILE/
- PARAMETERFILE/
- ASMCMD> rm PARAMETERFILE/ -r
- You may delete multiple files and/or directories.
- Are you sure? (y/n) y
- ASMCMD> ls
- DATAFILE/
- ASMCMD> cd ..
- ASMCMD> ls
- ASM/
- CDB1/
- CDB2/
- ORCL2/
- orapwasm
- ASMCMD> cd ..
- ASMCMD> ls
- DATA/
- FRA/
- ASMCMD> cd fra
- ASMCMD> ls
- CDB1/
- ORCL2/
- ASMCMD> cd ORCL2/
- ASMCMD> ls
- CONTROLFILE/
- ONLINELOG/
- ASMCMD> cd ..
- ASMCMD> ls
- CDB1/
- ORCL2/
- ASMCMD> rm -rf ORCL2/
- ASMCMD> ls
- CDB1/
- ASMCMD> cd ..
- ASMCMD> ls
- DATA/
- FRA/
- ASMCMD> cd ..
- ASMCMD> cd
- usage: cd <dir>
- help: help cd
- ASMCMD> ls
- DATA/
- FRA/
- ASMCMD> cd data
- ASMCMD> ls
- ASM/
- CDB1/
- CDB2/
- ORCL2/
- orapwasm
- ASMCMD> cd orcl2
- ASMCMD> ls
- DATAFILE/
- ASMCMD> cd datafile
- ASMCMD> ls
- EXAMPLE.284.934891291
- SYSAUX.275.934891047
- SYSTEM.276.934891113
- USERS.277.934891199
- ASMCMD> exit
- [oracle@station26 admin]$ sqlplus /nolog
- SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 27 19:27:44 2017
- Copyright (c) 1982, 2014, Oracle. All rights reserved.
- SQL> conn sys/oracle_4U@pdb_orcl2 as sysdba
- Connected.
- SQL> select t.name , d.name ,t.con_id, d.status
- 2 from v$tablespace t, v$tempfile d
- 3 where t.ts#=d.ts#;
- NAME
- ------------------------------
- NAME
- --------------------------------------------------------------------------------
- CON_ID STATUS
- ---------- -------
- TEMP
- +DATA/CDB2/47853795B0E904BAE0531A00A8C0DAD5/TEMPFILE/temp.283.963697221
- 5 ONLINE
- SQL> exit
- Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
- and Real Application Testing options
- [oracle@station26 admin]$ cd /u01/app/oracle/oradata/
- [oracle@station26 oradata]$ ls
- cdb2 orcl
- [oracle@station26 oradata]$ cd cdb2
- [oracle@station26 cdb2]$ ls
- control01.ctl pdb2_2 redo01.log redo03.log system01.dbf undotbs01.dbf
- pdb2_1 pdbseed redo02.log sysaux01.dbf temp01.dbf users01.dbf
- [oracle@station26 cdb2]$ cd pdb2_1
- [oracle@station26 pdb2_1]$ ls
- pdbseed_temp012017-12-22_06-04-39-PM.dbf sysaux01.dbf system01.dbf
- [oracle@station26 pdb2_1]$ cd ..
- [oracle@station26 cdb2]$ ls
- control01.ctl pdb2_2 redo01.log redo03.log system01.dbf undotbs01.dbf
- pdb2_1 pdbseed redo02.log sysaux01.dbf temp01.dbf users01.dbf
- [oracle@station26 cdb2]$ cd pdb2_2
- [oracle@station26 pdb2_2]$ ls
- CDB2
- [oracle@station26 pdb2_2]$ cd CDB2
- [oracle@station26 CDB2]$ ls
- 612B093C409C4C0FE0531A00A8C013C6
- [oracle@station26 CDB2]$ cd 612B093C409C4C0FE0531A00A8C013C6
- [oracle@station26 612B093C409C4C0FE0531A00A8C013C6]$ ls
- datafile
- [oracle@station26 612B093C409C4C0FE0531A00A8C013C6]$ cd datafile
- [oracle@station26 datafile]$ ls
- o1_mf_sysaux_f41yt1kj_.dbf o1_mf_system_f41yt1kf_.dbf o1_mf_temp_f41yt1kl_.dbf
- [oracle@station26 datafile]$ cd ..
- [oracle@station26 612B093C409C4C0FE0531A00A8C013C6]$ ls
- datafile
- [oracle@station26 612B093C409C4C0FE0531A00A8C013C6]$ cd ..
- [oracle@station26 CDB2]$ ls
- 612B093C409C4C0FE0531A00A8C013C6
- [oracle@station26 CDB2]$ cd ..
- [oracle@station26 pdb2_2]$ ls
- CDB2
- [oracle@station26 pdb2_2]$ cd ..
- [oracle@station26 cdb2]$ ls
- control01.ctl pdb2_2 redo01.log redo03.log system01.dbf undotbs01.dbf
- pdb2_1 pdbseed redo02.log sysaux01.dbf temp01.dbf users01.dbf
- [oracle@station26 cdb2]$ cd pdbseed
- [oracle@station26 pdbseed]$ ls
- pdbseed_temp012017-12-22_06-04-39-PM.dbf sysaux01.dbf system01.dbf
- [oracle@station26 pdbseed]$ cd ..
- [oracle@station26 cdb2]$ ls
- control01.ctl pdb2_2 redo01.log redo03.log system01.dbf undotbs01.dbf
- pdb2_1 pdbseed redo02.log sysaux01.dbf temp01.dbf users01.dbf
- [oracle@station26 cdb2]$ cd ..
- [oracle@station26 oradata]$ ls
- cdb2 orcl
- [oracle@station26 oradata]$
复制代码 把非容器插入容器数据库时,在执行noncdb_t0_pdb.sql脚本前,不要手工打开库:
- select con_id , name , open_mode
- from v$pdbs;
- select con_id, pdb_name, status
- from cdb_pdbs;
- alter pluggable database pdb_orcl2 open ;
复制代码
插入非cdb如果要拷贝,语法是:
- create pluggable database xxx using '...xml'
- file_name_convert=('源头',‘目的地’);
复制代码
如果要改插件数据库的名称, 要在插件中改,插件要打开成startup restrict:
- alter pluggable database xxx rename global_name to yyy
复制代码
外面插入的数据库,是没有pdb_admin..这类的本地用户的:
- select u.USERNAME
- from cdb_users u
- where con_id=5 and common='NO';
-
- select u.USERNAME
- from cdb_users u
- where con_id=3 and common='NO';
-
-
- select u.USERNAME
- from cdb_users u
- where con_id=4 and common='NO';
复制代码
检查别的插件数据库,是否能插入本容器的语法:
- QL> conn / as sysdba
- Connected.
- SQL> show con_name
- CON_NAME
- ------------------------------
- CDB$ROOT
- SQL> set serveroutput on
- SQL> declare
- 2 v_1 boolean := false;
- 3 begin
- 4 v_1 := dbms_pdb.CHECK_PLUG_COMPATIBILITY('/home/oracle/pdb1_1.xml','pdb1_1') ;
- 5 if v_1 then
- 6 dbms_output.put_line('OK');
- 7 end if;
- 8 end;
- 9 /
- OK
- PL/SQL procedure successfully completed.
复制代码 如果以上检查显示成false请看以下视图:
- SQL> select message, action from pdb_plug_in_violations
- 2 ;
- MESSAGE
- --------------------------------------------------------------------------------
- ACTION
- --------------------------------------------------------------------------------
- CDB parameter memory_target mismatch: Previous 2G Current 3104M
- Please check the parameter in the current CDB
- PDB plugged in is a non-CDB, requires noncdb_to_pdb.sql be run.
- Run noncdb_to_pdb.sql.
- CDB parameter sga_target mismatch: Previous 1536M Current 0
- Please check the parameter in the current CDB
- Service name or network name of service orcl in the PDB is invalid or conflicts
- with an existing service name or network name in the CDB.
- Drop the service and recreate it with an appropriate name.
- CDB parameter pga_aggregate_target mismatch: Previous 512M Current 0
- Please check the parameter in the current CDB
- PDB plugged in is a non-CDB, requires noncdb_to_pdb.sql be run.
- Run noncdb_to_pdb.sql.
- CDB parameter _catalog_foreign_restore mismatch: Previous FALSE Current TRUE
- Please check the parameter in the current CDB
- 7 rows selected.
- SQL> select message, action from pdb_plug_in_violations where pdb_name ='PDB1_1';
- select message, action from pdb_plug_in_violations where pdb_name ='PDB1_1'
- *
- ERROR at line 1:
- ORA-00904: "PDB_NAME": invalid identifier
- SQL> select message, action from pdb_plug_in_violations where name='PDB1_1';
- MESSAGE
- --------------------------------------------------------------------------------
- ACTION
- --------------------------------------------------------------------------------
- CDB parameter _catalog_foreign_restore mismatch: Previous FALSE Current TRUE
- Please check the parameter in the current CDB
- 1 row selected.
- SQL>
复制代码
- select con_id, name , open_mode from v$pdbs;
- select con_id , pdb_name , status from cdb_pdbs;
- alter pluggable database pdb1_1 open ;
- select t.con_id , t.name , d. name , d.status
- from v$tablespace t, v$datafile d
- where t.con_id=d.con_id and t.ts#=d.ts#
- order by 1 ,2;
-
- alter pluggable database all except pdb2_2 open ;
-
-
- create or replace trigger trg1
- after startup on database
- begin
- execute immediate 'alter pluggable database all open';
- end;
复制代码
|
|