Oracle Database cloning experiment series-stop cloning-database cloning with the same name

Source: Internet
Author: User

1. Clone Oracle with the same name-create a new PROD1 database on the 131 server and migrate it to the 137 server. The database name is still PROD1.
1.1 dbca-131 PROD1
Sys/oracle
System/oracle
Uncheck all components
No EM
No Flashback
No Archiving
ORA-00845-when using dbca to create a database
Starting with Oracle Database 11g, the Automatic Memory Management feature requires more shared memory (/dev/shm) and file descriptors. the size of the shared memory shocould be at least the greater of MEMORY_MAX_TARGET and MEMORY_TARGET for each Oracle instance on the computer. if MEMORY_MAX_TARGET or MEMORY_TARGET is set to a non zero value, and an incorrect size is assigned to the shared memory, it will result in an ORA-00845 error at startup.
 

[Oracle @ oelr5u8-1 admin] $ df-h | grep shm
Tmpfs 2.0G 400 M 1.6G 20%/dev/shm
 

For it's only 400 M and less than the parameter memory_target = 1.6G
So let's modify it to 2G
[Root @ oelr5u8-1 ~] # Vi/etc/fstab
Modify:
Tmpfs/dev/shm tmpfs defaults 0 0
To:
Tmpfs/dev/shm tmpfs ults, size = 2G 0 0
Init 6
 

Then do the same on 192.168.182.133
 

Export ORACLE_SID = PROD1
Sqlplus/as sysdba
 

SYS @ PROD1> select dbid from v $ database;
 

DBID
----------
2065008095
 

 

SYS @ PROD1> create pfile from spfile;
 

File created.
 

SYS @ PROD1> alter database backup controlfile to trace;
 

Database altered.
 

SYS @ PROD1> show parameter user_dump
 

NAME TYPE VALUE
-----------------------------------------------------------------------------
User_dump_dest string/u01/app/oracle/diag/rdbms/pro
D1/PROD1/trace

Cd/u01/app/oracle/diag/rdbms/prod1/PROD1/trace
[Oracle @ oelr5u8-1 trace] $ cp PROD1_ora_6245.trc/home/oracle/control01.txt
Cd
Vi control01.txt
-- Other tempfiles may require adjustment.
Alter tablespace temp add tempfile '/u01/app/oracle/oradata/PROD1/temp01.dbf'
SIZE 20971520 reuse autoextend on next 655360 MAXSIZE 32767 M;
-- End of tempfile additions.
STARTUP NOMOUNT
Create controlfile reuse database "PROD1" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
# MAXLOGHISTORY 292
LOGFILE
GROUP 1'/u01/app/oracle/oradata/PROD1/redo01.log' SIZE 50 m blocksize 512,
GROUP 2'/u01/app/oracle/oradata/PROD1/redo02.log 'SIZE 50 m blocksize 512,
GROUP 3 '/u01/app/oracle/oradata/PROD1/redo03.log' SIZE 50 m blocksize 512
-- STANDBY LOGFILE
DATAFILE
'/U01/app/oracle/oradata/PROD1/system01.dbf ',
'/U01/app/oracle/oradata/PROD1/sysaux01.dbf ',
'/U01/app/oracle/oradata/PROD1/undotbs01.dbf ',
'/U01/app/oracle/oradata/PROD1/users01.dbf'
Character set AL32UTF8
;
 

[Oracle @ oelr5u8-1 ~] $ Scp control01.txt oel6.4-1 :~
 

1.2 cold backup tar-131 PROD1
 

SYS @ PROD1> select name from v $ dbfile;
 

NAME
--------------------------------------------------------------------------------
/U01/app/oracle/oradata/PROD1/system01.dbf
/U01/app/oracle/oradata/PROD1/sysaux01.dbf
/U01/app/oracle/oradata/PROD1/undotbs01.dbf
/U01/app/oracle/oradata/PROD1/users01.dbf
 

 

SYS @ PROD1> select member from v $ logfile;
 

MEMBER
--------------------------------------------------------------------------------
/U01/app/oracle/oradata/PROD1/redo01.log
/U01/app/oracle/oradata/PROD1/redo02.log
/U01/app/oracle/oradata/PROD1/redo03.log
 

SYS @ PROD1> select name from v $ controlfile;
 

NAME
--------------------------------------------------------------------------------
/U01/app/oracle/oradata/PROD1/control01.ctl
/U01/app/oracle/oradata/PROD1/control02.ctl
 

SYS @ PROD1> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
 

Cd $ ORACLE_BASE/oradata
Tar-zcvf PROD1.tar./PROD1
Scp PROD1.tar oel6.4-1: $ ORACLE_BASE/oradata
 

Cd $ ORACLE_HOME/dbs
Scp initPROD1.ora oel6.4-1:/s01/app/oracle/product/11.2.0/db_1/dbs
Scp orapwPROD1 oel6.4-1:/s01/app/oracle/product/11.2.0/db_1/dbs
 

1.3 scp cold backup tar including datafiles, control files, pfile, orapwdfile from 131-> 137
 

1.4 unzip tar from 131-> 137
Cd $ ORACLE_BASE/oradata
Tar-zxvf PROD1.tar
 

1.5 check path and SID
Vi initPROD1.ora
Modify "/u01" to "/s01"
PROD1. _ db_cache_size = 687865856
PROD1. _ java_pool_size = 16777216
PROD1. _ large_pool_size = 16777216
PROD1. _ oracle_base = '/s01/app/oracle' # ORACLE_BASE set from environment
PROD1. _ pga_aggregate_target = 687865856
PROD1. _ sga_target = 1006632960
PROD1. _ shared_io_pool_size = 0
PROD1. _ shared_pool_size = 268435456
PROD1. _ streams_pool_size = 0
*. Audit_file_dest = '/s01/app/oracle/admin/PROD1/adump'
*. Audit_trail = 'db'
*. Compatible = '11. 2.0.0.0'
*. Control_files = '/s01/app/oracle/oradata/PROD1/control01.ctl', '/s01/app/oracle/oradata/PROD1/control02.ctl'
*. Db_block_size = 8192
*. Db_domain =''
*. Db_name = 'prod1'
*. Diagnostic_dest = '/s01/app/oracle'
*. Memory_target = 1686110208
*. Open_cursors = 300
*. Processses = 150
*. Remote_login_passwordfile = 'clusive'
*. Undo_tablespace = 'undotbs1'
 

According to: *. audit_file_dest = '/s01/app/oracle/admin/PROD1/adump'
[Oracle @ oel6 oradata] $ mkdir-p/s01/app/oracle/admin/PROD1/adump
 

Vi control01.txt
Modify "/u01" to "/s01"
STARTUP NOMOUNT
Create controlfile reuse database "PROD1" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
# MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/s01/app/oracle/oradata/PROD1/redo01.log' SIZE 50 m blocksize 512,
GROUP 2 '/s01/app/oracle/oradata/PROD1/redo02.log' SIZE 50 m blocksize 512,
GROUP 3 '/s01/app/oracle/oradata/PROD1/redo03.log' SIZE 50 m blocksize 512
-- STANDBY LOGFILE
DATAFILE
'/S01/app/oracle/oradata/PROD1/system01.dbf ',
'/S01/app/oracle/oradata/PROD1/sysaux01.dbf ',
'/S01/app/oracle/oradata/PROD1/undotbs01.dbf ',
'/S01/app/oracle/oradata/PROD1/users01.dbf'
Character set AL32UTF8
;
 

Cd/s01/app/oracle/oradata/PROD1
Rm control *
 

1.6 create spfile from pfile-137 PROD1
[Oracle @ oel6 PROD1] $ export ORACLE_SID = PROD1
[Oracle @ oel6 PROD1] $ sqlplus/nolog
 

SQL * Plus: Release 11.2.0.1.0 Production on Mon Mar 31 16:15:13 2014
 

Copyright (c) 1982,200 9, Oracle. All rights reserved.
 

@> Connect sys/oracle as sysdba
Connected to an idle instance.
SYS @ PROD1> create spfile from pfile;
 

File created.
 

SYS @ PROD1> startup nomount
ORACLE instance started.
 

Total System Global Area 1686925312 bytes
Fixed Size 2213976 bytes
Variable Size 989857704 bytes
Database Buffers 687865856 bytes
Redo Buffers 6987776 bytes
SYS @ PROD1> create controlfile reuse database "PROD1" RESETLOGS NOARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7. LOGFILE
8 GROUP 1 '/s01/app/oracle/oradata/PROD1/redo01.log' SIZE 50 m blocksize 512,
9 GROUP 2 '/s01/app/oracle/oradata/PROD1/redo02.log' SIZE 50 m blocksize 512,
10 GROUP 3 '/s01/app/oracle/oradata/PROD1/redo03.log' SIZE 50 m blocksize 512
11 -- STANDBY LOGFILE
12 DATAFILE
13 '/s01/app/oracle/oradata/PROD1/system01.dbf ',
14'/s01/app/oracle/oradata/PROD1/sysaux01.dbf ',
15'/s01/app/oracle/oradata/PROD1/undotbs01.dbf ',
16'/s01/app/oracle/oradata/PROD1/users01.dbf'
17 character set AL32UTF8
18;
 

Control file created.
 

SYS @ PROD1> shutdown immediate
ORA-01109: database not open
 

 

Database dismounted.
ORACLE instance shut down.
SYS @ PROD1> startup mount
ORACLE instance started.
 

Total System Global Area 1686925312 bytes
Fixed Size 2213976 bytes
Variable Size 989857704 bytes
Database Buffers 687865856 bytes
Redo Buffers 6987776 bytes
Database mounted.
SYS @ PROD1> alter database open resetlogs;
 

Database altered.
 

SYS @ PROD1> select dbid from v $ database;
 

DBID
----------
2065008095
Same DBID as the source database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.