Get the App
SLTechnology News&Howtos  ›  Database  › 

Oracle adds pdb environment, and realizes online cloning across servers through database link.

Shulou Source: shulou.com Published: 2022-06-01 07:21:11 11月05日 Update

Premise: install the database software and create the database of CDB mode.

This article introduces the content: first, how to create pdb, and create tablespaces, users

Second, and clone the pdb across servers online through database link.

one。 How to create pdb and tablespaces, user 1. Log in to the database (CDB) sqlplus / as sysdba2. Query the data file path select name from vault datafileter3. Create pdbCREATE PLUGGABLE DATABASE YXC ADMIN USER YXC_ADMIN IDENTIFIED BY YXC_ADMIN123STORAGE (MAXSIZE 32G) DEFAULT TABLESPACE YXC_DATADATAFILE'/ u01 DEFAULT TABLESPACE YXC_DATADATAFILE'/ u01 apprenticeships, oracleandoradatas, YXC plains, YXC plains, oracleDATA01.dbf' SIZE 1024M AUTOEXTEND ONPATH_PREFIX ='/ u01/app/oracle/oradata/yun/YXC/'FILE_NAME_CONVERT = ('/ u01plains, oracles, oradatas, etc.); 4. Create the tablespace create tablespace YXC_IDX datafile'/ u01 size 1024mautoextend on next maxsize unlimited; add:

(1) change the tablespace file name:

Alter tablespace YXC_DATA rename datafile'/ u01 apprenticeship oracleDATA01.dbf' to'/ u01apprenticedoradata'/ u01apprenticedoracleDATA02.dbf'

The target file needs to be created at the operating system level in advance.

(2) Delete tablespace

Alter database default tablespace YXC_DATA

If it is a default tablespace, you need to change the default tablespace to another tablespace in advance:

Alter database default tablespace USERS;5. Create the user create user yxc identified by yxc123 default tablespace YXC_DATA;6. Empowered grant connect, resource to yxc;grant imp_full_database,unlimited tablespace to yxc; II. Clone this pdb online across servers through database link. 1. Source environment side (1). Create clone user SQL > create user c##clone identified by clone123 container=all;SQL > grant dba to c##clone container=all;2 destination (1) create DBLINKcreate database link dblink_clone connect to c##clone identified by andy using'(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = source-side IP) (PORT = 1521)) (CONNECT_DATA= (SERVER = DEDICATED) (SERVICE_NAME = source-side CDB service name)' (2) modify file mapping SQL > alter session set pdb_file_name_convert='yxc','yxc_clone'; (3) Clone SQL > create pluggable database yxc_clone from yxc@dblink_clone; (4) Open database SQL > alter pluggable database yxc_clone open

Tags: Space data database file user service server online target environment operating system content premise name level pattern system empowerment path software Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker vpn Linux Shulou Tech Info macOS