2014년 1월 14일 화요일

Oracle 12c Multitenant Database 다른 서버에 Plug-in 하기

Pluggable Database 다른 서버에 Plug 하기

  
실습을 진행한 서버의 정보는 다음과 같다.

<Source>
Hostname: db12cSourceSource.oracle.com
IP:192.168.56.102
Database Version: 12.1.0.1

<Target>
Hostname: db12cSourceTarget.oracle.com
IP:192.168.56.200
Database Version: 12.1.0.1


1) 기존 데이터베이스를 Unplug 한다.
[oracle@db12cSource ~]$ hostname
db12cSource.oracle.com
[oracle@db12cSource ~]$ . oraenv
ORACLE_SID = [orcl] ?
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@db12cSource ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Mon Jan 13 22:03:58 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options


SQL> ALTER PLUGGABLE DATABASE PDB1 UNPLUG INTO '/home/oracle/PDB1.XML';

Pluggable database altered.

SQL> DROP PLUGGABLE DATABASE PDB1 KEEP DATAFILES;

Pluggable database dropped.

SQL> EXIT;
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

2) 데이터파일과 XML 파일을 묶어 Target Server 전송한다.
[oracle@db12cSource datafile]$ cd /u01/app/oracle/oradata/orcl/pdb1
[oracle@db12cSource pdb1]$ ls
sysaux01.dbf  system01.dbf  users01.dbf
[oracle@db12cSource pdb1]$ tar -cvf /home/oracle/PDB1.tar *
sysaux01.dbf
system01.dbf
users01.dbf
[oracle@db12cSource ~]$ cd /home/oracle/
[oracle@db12cSource ~]$ ls PDB1*
PDB1.tar  PDB1.XML
[oracle@db12cSource ~]$ scp PDB1* 192.168.56.200:/home/oracle/
oracle@192.168.56.200's password:
PDB1.tar                                                                    100%  452MB  22.6MB/s   00:20   
PDB1.XML
[oracle@db12cSource ~]$

3) 이제, Target Server 접속하여 데이터파일을 위치시킨다.
[oracle@db12cSource ~]$ ssh 192.168.56.200
oracle@192.168.56.200's password:
[oracle@db12cTarget ~]$ ll
total 463372
drwxr-xr-x 2 oracle oracle        4096 Jul  8  2013 Desktop
drwxr-xr-x 2 oracle oinstall      4096 Aug  1 01:18 exercises
-rw-r--r-- 1 oracle oinstall 474009600 Jan 13 23:15 PDB1.tar
-rw-r--r-- 1 oracle oinstall      3706 Jan 13 23:15 PDB1.XML
[oracle@db12cTarget ~]$ chmod 755 PDB1*
[oracle@db12cTarget ~]$ ll
total 463372
drwxr-xr-x 2 oracle oracle        4096 Jul  8  2013 Desktop
drwxr-xr-x 2 oracle oinstall      4096 Aug  1 01:18 exercises
-rwxr-xr-x 1 oracle oinstall 474009600 Jan 13 23:15 PDB1.tar
-rwxr-xr-x 1 oracle oinstall      3706 Jan 13 23:15 PDB1.XML
[oracle@db12cTarget ~]$ tar -xvf PDB1.tar
sysaux01.dbf
system01.dbf
users01.dbf
[oracle@db12cTarget ~]$ cd /u01/app/oracle/oradata/orcl/
[oracle@db12cTarget orcl]$ mkdir pdb1
[oracle@db12cTarget orcl]$ cd pdb1/
[oracle@db12cTarget pdb1]$ mv /home/oracle/*.dbf .
[oracle@db12cTarget pdb1]$ ls
sysaux01.dbf  system01.dbf  users01.dbf

4) 데이터베이스에 접속해서 Plug 수행한다.
[oracle@db12cTarget ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Tue Jan 14 09:32:24 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> CREATE PLUGGABLE DATABASE PDB1 USING '/home/oracle/PDB1.XML'
  2  SOURCE_FILE_NAME_CONVERT=NONE
  3  NOCOPY
  4  STORAGE UNLIMITED
  5  ;

Pluggable database created.

5) Pluggable Database 오픈한다.
SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN;


댓글 없음:

댓글 쓰기