- create pluggable database
#主库
alter system set db_create_file_dest='/u02/oradata/MYCDB/';
create pluggable database MPREPORT admin user REPORT identified by REPORT123
file_name_convert=('/u02/oradata/MYCDB/pdbseed','/u02/oradata/MYCDB/MPREPORT');
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MPREPORT MOUNTED
SQL> alter system switch logfile;
#备库
[oracle@XAG192 ~]$ sqlplus / as sysdba
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MPREPORT MOUNTED
- OPEN PDB
#主库
SQL> alter pluggable database MPREPORT open;
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MPREPORT READ WRITE NO
SQL> alter system switch logfile;
#备库
SQL> alter pluggable database MPREPORT open;
- 临时表空间处理
#主库
SQL> alter session set container=MPREPORT;
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 MPREPORT READ WRITE NO
SQL> select tablespace_name,file_name,bytes/1024/1024 mb from dba_temp_files;
TABLESPACE_NAME FILE_NAME MB
-----------------------------------------------------------------------------
TEMP /u02/oradata/MYCDB/MPREPORT/temp012019-06-16_11-13-46-727-AM.dbf 36
#备库
SQL> select tablespace_name,file_name,bytes/1024/1024 mb from dba_temp_files;
no rows selected
#主库
create tablespace REPORT_UD datafile
'/u02/oradata/MYCDB/MPREPORT/REPORT_UD_1.dbf' size 64M AUTOEXTEND ON NEXT 64M MAXSIZE UNLIMITED,
'/u02/oradata/MYCDB/MPREPORT/REPORT_UD_2.dbf' size 64M AUTOEXTEND ON NEXT 64M MAXSIZE UNLIMITED
default storage (initial 128K next 2M pctincrease 0);
create temporary tablespace REPORT_TD1 tempfile
'/u02/oradata/MYCDB/MPREPORT/REPORT_TD1_1.dbf' size 64M REUSE AUTOEXTEND ON NEXT 64M MAXSIZE 4096M,
'/u02/oradata/MYCDB/MPREPORT/REPORT_TD1_2.dbf' size 64M REUSE AUTOEXTEND ON NEXT 64M MAXSIZE 4096M extent management local;
ALTER TABLESPACE REPORT_TD1 TABLESPACE GROUP REPORT_GROUP;
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE REPORT_GROUP;
SQL> select * from dba_tablespace_groups;
GROUP_NAME TABLESPACE_NAME
------------------------------ ------------------------------
REPORT_GROUP REPORT_TD1
ALTER DATABASE DEFAULT TABLESPACE REPORT_UD;
#备库
SQL> alter session set container=CDB$ROOT;
SQL> alter pluggable database MPREPORT close;
#主库
SQL> alter session set container=CDB$ROOT;
SQL> alter pluggable database MPREPORT close;
SQL> exit
#备库
SQL> alter pluggable database MPREPORT open;
SQL> alter session set container=MPREPORT;
#主库
SQL> alter pluggable database MPREPORT open;
SQL> alter session set container=MPREPORT;
drop tablespace TEMP including contents and datafiles cascade constraints;
ALTER DATABASE DATAFILE '/u02/oradata/MYCDB/MPREPORT/undotbs01.dbf' RESIZE 128M;
ALTER DATABASE DATAFILE '/u02/oradata/MYCDB/MPREPORT/undotbs01.dbf' AUTOEXTEND ON NEXT 128M;
select tablespace_name,file_name,bytes/1024/1024 mb from dba_data_files;
GRANT DBA to REPORT;
grant connect,resource,unlimited tablespace to REPORT;
grant create any directory to REPORT;
grant drop any directory to REPORT;
- 备库创建追加临时表空间文件
SQL> select TABLESPACE_NAME,STATUS,EXTENT_MANAGEMENT,ALLOCATION_TYPE,SEGMENT_SPACE_MANAGEMENT from dba_tablespaces;
TABLESPACE_NAME STATUS EXTENT_MAN ALLOCATIO SEGMEN
------------------------------ --------- ---------- --------- ------
SYSTEM ONLINE LOCAL SYSTEM MANUAL
SYSAUX ONLINE LOCAL SYSTEM AUTO
UNDOTBS1 ONLINE LOCAL SYSTEM MANUAL
REPORT_UD ONLINE LOCAL SYSTEM AUTO
REPORT_TD1 ONLINE LOCAL UNIFORM MANUAL
SQL> select tablespace_name,file_name from dba_temp_files;
no rows selected
ALTER TABLESPACE REPORT_TD1 ADD TEMPFILE '/u02/oradata/MYCDB/MPREPORT/REPORT_TD1_1.dbf'
SIZE 64M REUSE AUTOEXTEND ON NEXT 64M MAXSIZE 4096M;
ALTER TABLESPACE REPORT_TD1 ADD TEMPFILE '/u02/oradata/MYCDB/MPREPORT/REPORT_TD1_2.dbf'
SIZE 64M REUSE AUTOEXTEND ON NEXT 64M MAXSIZE 4096M;
SQL> select tablespace_name,file_name from dba_temp_files;
TABLESPACE_NAME FILE_NAME
------------------------------------------------------------------------------
REPORT_TD1 /u02/oradata/MYCDB/MPREPORT/REPORT_TD1_1.dbf
REPORT_TD1 /u02/oradata/MYCDB/MPREPORT/REPORT_TD1_2.dbf
DGMGRL> show configuration;
Configuration - ADGbroker
Protection Mode: MaxAvailability
Members:
MYCDB191 - Primary database
MYCDB192 - Physical standby database
Fast-Start Failover: Disabled
Configuration Status:
SUCCESS (status updated 51 seconds ago)