Clone and cold migration of oracle (Direct Copy of data files)

Source: Internet
Author: User
Recently, an Oracle 10g Data cold migration was conducted, which is very simple, but the basic operation process is as follows: first, prepare the migration target server, initialize the environment, and install the data software. Basic Environment initialization, dependency package installation, related directories, and users need to be installed (the target machine environment should be the same as the original environment). I use clone to install database software.

Recently, an oracle 10g Data cold migration was conducted, which is very simple, but it is still a basic operation process: first, prepare the migration target server, initialize the environment, and install the data software. Basic Environment initialization, dependency package installation, related directories, and users need to be installed (the target machine environment should be the same as the original environment). I use clone to install database software.

Recently, a 10g oracle Data cold migration was performed, which is very simple, but the basic operation process is as follows:

First, prepare the migration target server, initialize the environment, and install the data software.

Basic Environment initialization, dependency package installation, related directories, and users must be installed properly (the target machine environment should be the same as the original environment). I use clone to install database software, package the online product directory to the target server.

Memory check

grep MemTotal /proc/meminfoMemTotal:     32949816 kB

Disk Space check

df -k /dev/shm/Filesystem           1K-blocks      Used Available Use% Mounted ontmpfs                 16474908         0  16474908   0% /dev/shmdf -h /tmpFilesystem            Size  Used Avail Use% Mounted on/dev/shm               16G     0   16G   0% /tmp

Kernel check

uname -r2.6.18-194.el5

Dependency package check

rpm -q \binutils \compat-libstdc++-33 \elfutils-libelf \elfutils-libelf-devel \gcc \gcc-c++ \glibc \glibc-common \glibc-devel \glibc-headers \ksh \libaio \libaio-devel \libgcc \libgomp \libstdc++ \libstdc++-devel \make \numactl-devel \sysstat \unixODBC \unixODBC-devel | grep "not installed"

Create user

groupadd oinstallgroupadd dbachattr -i /etc/passwd /etc/shadowuseradd -g oinstall -G dba oraclepasswd oraclechattr +i /etc/passwd /etc/shadow

Directory Creation and Environment Parameter Modification

vi /etc/sysctl.conffs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 8388608kernel.shmmax = 34359738368kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048586sysctl -pvi /etc/security/limits.conforacle              soft    nproc   2047oracle              hard    nproc   16384oracle              soft    nofile  1024oracle              hard    nofile  65536oracle              soft    stack   10240mkdir -p /U01/app/oracle/chown -R oracle:oinstall /U01/chmod -R 775 /U01/vi /etc/pam.d/loginsession    required     pam_limits.sovi /etc/profileif [ $USER = "oracle" ]; then        if [ $SHELL = "/bin/ksh" ]; then              ulimit -p 16384              ulimit -n 65536        else              ulimit -u 16384 -n 65536        fifivi .bash_profileexport ORACLE_BASE=/U01/app/oracleexport ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1 export ORACLE_SID=testexport PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdk/bin:$PATH export LANG="en_US.UTF-8" export NLS_LANG=american_AMERICA.UTF8 export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"

Start packaging oracle software for the original server

[@crm.cyou.com product]# pwd/U01/app/oracle/product[@crm.cyou.com product]# tar -zcf 10.2.0.tgz 10.2.0

Copy the file to the target server, decompress the file, and start clone.

cd $ORACLE_HOME/clone/bin/perl clone.pl ORACLE_BASE=/U01/app/oracle ORACLE_HOME=/U01/app/oracle/product/10.2.0  ORACLE_HOME_NAME=db_1./runInstaller -clone -waitForCompletion  "ORACLE_BASE=/U01/app/oracle" "ORACLE_HOME=/U01/app/oracle/product/10.2.0/db_1" "ORACLE_HOME_NAME=db_1" -silent -noConfig -nowaitStarting Oracle Universal Installer...Checking swap space: must be greater than 500 MB.   Actual 16386 MB    PassedPreparing to launch Oracle Universal Installer from /tmp/OraInstall2012-03-21_05-09-02PM. Please wait ...Oracle Universal Installer, Version 10.2.0.0 ProductionCopyright (C) 1999, 2011, Oracle. All rights reserved.You can find the log of this install session at:/U01/app/oracle/oraInventory/logs/cloneActions.....2PM.log.................................................................................................... 100% Done.Installation in progress (Wednesday, March 21, ... 5:09:10 PM CST)...............................................................................                                                 79% Done.Install successfulLinking in progress (Wednesday, March 21,... 5:09:16 PM CST)Link successfulSetup in progress (Wednesday, March 21, ... 5:09:46 PM CST)Setup successfulEnd of install phases.(Wednesday, March 21, ....:08 PM CST)WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.To register the new inventory please run the script '/U01/app/oracle/oraInventory/orainstRoot.sh' with root privileges.If you do not register the inventory, you may not be able to update or patch the products you installed.The following configuration scripts need to be executed as the "root" user./U01/app/oracle/oraInventory/orainstRoot.sh/U01/app/oracle/product/10.2.0/db_1/root.shTo execute the configuration scripts:    1. Open a terminal window    2. Log in as "root"    3. Run the scriptsThe cloning of db_1 was successful.Please check '/U01/app/oracle/oraInventory/logs/cloneActions......PM.log' for more details.9.run sh scripts[root@bf_test_qd_119 ~]# /U01/app/oracle/oraInventory/orainstRoot.shChanging permissions of /U01/app/oracle/oraInventory.Adding read,write permissions for group.Removing read,write,execute permissions for world.Changing groupname of /U01/app/oracle/oraInventory to oinstall.The execution of the script is complete.[root@bf_test_qd_119 ~]# /U01/app/oracle/product/10.2.0/db_1/root.shCheck /U01/app/oracle/product/10.2.0/db_1/install/......

This clone is fast. After OK, you can stop the original oracle instance and listen to it.

Select distinct username from v $ session; check if the application has stopped. Then stop all listening lsnrctl stop LISTENERlsnrctl stop LISTENER1532lsnrctl stop LISTENER1528lsnrctl stop LISTENER1525

Stop Database

Shutdown immediate // after the application is stopped, stop the database.

Start copying data files

scp -r /U01/app/oracle/product/10.2.0/dbs/*  1.1.1.1:/U01/app/oracle/product/10.2.0/dbs/scp -r oradata/ 1.1.1.1:/U01/app/oracle/cd /U01/app/oracle/admin/ldjbmdb && mkdir -p adump  bdump  cdump  dpdump  pfile  udump  utl_filecd /U01/app/oracle && mkdir -p arch  flash_recovery_area    oraInventory

You need to copy the file as follows:

1. Control File

2. Data Files

3. parameter file spfile? (Consistent environment)

4. Password File

5. redo

I didn't check the paths of these files first, and then copy them. Here, my directories are basically not changed. The control files, data files, and redo files are all in oradata, the password files and parameter files are all in the dbs directory. So I only need to copy two directories.

Then create the corresponding directory and start the database.

Startup mount; alter database archivelog; alter database open; archive log list; alter database force logging; select log_mode, force_logging from v $ database; start listening lsnrctl start LISTENERlsnrctl start LISTENER1532lsnrctl start starting LISTENER1525

Enable archivelog for the database (here is the reason for selecting cold migration)

Some steps are as follows:

A. Check scheduled tasks

B. Firewall

C. Self-starting Database

Original article address: clone and cold migration of oracle (Direct Copy of data files), thanks to the original author for sharing.

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.