CLONE数据库软件+手动安装数据库

1. 在目标端准备环境。
1.1 配置SYSCTL.CONF

kernel.shmall = 4294967296
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586

sysctl -p


1.2 配置LOGIN文件:

vi /etc/pam.d/login
session required /lib/security/pam_limits.so


1.3 配置LIMITS文件:

vi /etc/security/limits.conf 
Oracle soft memlock 5242880
Oracle hard memlock 524280
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 65536
oracle hard nofile 65536


1.4 创建组与账户

[root@localhost ~]# groupadd oinstall
[root@localhost ~]# groupadd dba
[root@localhost ~]# useradd -g oinstall -G dba oracle


1.5 安装包:

本地配置YUM源方法:
mount /dev/cdrom /mnt
mkdir /yum
cp -r /mnt/* /yum/
vi /etc/yum.repos.d/local.repo
[base]
name=linux 5
baseurl=file:///yum
gpgcheck=0
enable=1

vi /usr/lib/python2.4/site-packages/yum/yumRepo.py
remote = url + '/yum' + relative

createrepo /yum

即可执行安装:
yum -y install pdksh libXp binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio-devel libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel compat-libstdc++-33





 

2. 在源安装环境生成TAR包:

 cd /u01/app/oracle
 tar -zcvf oracle_home.tar.gz oracle_home
 scp oracle_home.tar.gz 10.19.131.128:/u01/app/oracle/


3. 在目标环境里解压软件:

[root@localhost ~]# cd /u01/app/oracle
[root@localhost oracle]# ls
oracle_home.tar.gz
[root@localhost oracle]# tar -xzvf oracle_home.tar.gz 


4. 在目标环境里进行CLONE:

[root@localhost ~]# chown -R oracle:oinstall /u01
[root@localhost ~]# chmod -R 775 /u01
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ cd /u01/app/oracle/oracle_home/clone/bin/
[oracle@localhost bin]$ perl clone.pl ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/oracle_home ORACLE_HOME_NAME=ORA11G_HOME
./runInstaller -clone -waitForCompletion  "ORACLE_BASE=/u01/app/oracle" "ORACLE_HOME=/u01/app/oracle/oracle_home" "ORACLE_HOME_NAME=ORA11G_HOME" -silent -noConfig -nowait 
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 8189 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-04-15_10-27-24PM. Please wait ...Oracle Universal Installer, Version 11.2.0.3.0 Production
Copyright (C) 1999, 2011, Oracle. All rights reserved.

You can find the log of this install session at:
 /u01/app/oraInventory/logs/cloneActions2014-04-15_10-27-24PM.log
.................................................................................................... 100% Done.

 

Installation in progress (Tuesday, April 15, 2014 10:27:35 PM EDT)
...............................................................................                                                 79% Done.
Install successful

Linking in progress (Tuesday, April 15, 2014 10:27:43 PM EDT)
Link successful

Setup in progress (Tuesday, April 15, 2014 10:28:28 PM EDT)
Setup successful

End of install phases.(Tuesday, April 15, 2014 10:28:53 PM EDT)
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/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/oraInventory/orainstRoot.sh
/u01/app/oracle/oracle_home/root.sh
To execute the configuration scripts:
    1. Open a terminal window
    2. Log in as "root"
    3. Run the scripts
    
The cloning of ORA11G_HOME was successful.
Please check '/u01/app/oraInventory/logs/cloneActions2014-04-15_10-27-24PM.log' for more details.


5. 用ROOT去执行脚本:

[root@localhost yum]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@localhost yum]# /u01/app/oracle/oracle_home/root.sh
Check /u01/app/oracle/oracle_home/install/root_localhost.localdomain_2014-04-15_22-30-15.log for the output of root script


查看/u01/app/oraInventory/ContentsXML/inventory.xml  中的ORACLEHOME路径不和现在的环境不一致,请修改下就可以了。


6. 手动创建数据库:
6.1 修改ORACLE用户的环境变量:

export ORACLE_SID=ora
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/oracle_home
export PATH=$ORACLE_HOME/bin:$PATH


6.2 创建参数文件。

*.audit_file_dest='/u01/app/oracle/admin/ora/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/ora/control01.ctl','/u01/app/oracle/flash_recovery_area/ora/controlfile/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='ora'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=8589934592
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=newtestXDB)'
*.open_cursors=300
*.pga_aggregate_target=2810183680
*.processes=1500
*.remote_login_passwordfile='exclusive'
*.sga_target=536870912
*.undo_tablespace='UNDOTBS1'


6.3 创建参数文件中所需要的路径:

[oracle@localhost dbs]$ mkdir -p /u01/app/oracle/admin/ora/adump
[oracle@localhost dbs]$ mkdir -p /u01/app/oracle/oradata/ora
[oracle@localhost dbs]$ mkdir -p /u01/app/oracle/flash_recovery_area/ora/controlfile
[oracle@localhost dbs]$ mkdir -p /u01/app/oracle/flash_recovery_area


6.4 启动到NOMOUNT

[oracle@localhost dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 15 22:45:00 2014

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

Connected to an idle instance.

SQL> create spfile from pfile; 

File created.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  534462464 bytes
Fixed Size                  2230072 bytes
Variable Size             163580104 bytes
Database Buffers          360710144 bytes
Redo Buffers                7942144 bytes


6.5 执行建库语句:

CREATE DATABASE ora
   USER SYS IDENTIFIED BY sys_password
   USER SYSTEM IDENTIFIED BY system_password
   LOGFILE GROUP 1 ('/u01/app/oracle/oradata/ora/redo01a.log','/u01/app/oracle/oradata/ora/redo01b.log') SIZE 100M BLOCKSIZE 512,
           GROUP 2 ('/u01/app/oracle/oradata/ora/redo02a.log','/u01/app/oracle/oradata/ora/redo02b.log') SIZE 100M BLOCKSIZE 512,
           GROUP 3 ('/u01/app/oracle/oradata/ora/redo03a.log','/u01/app/oracle/oradata/ora/redo03b.log') SIZE 100M BLOCKSIZE 512
   MAXLOGFILES 5
   MAXLOGMEMBERS 5
   MAXLOGHISTORY 1
   MAXDATAFILES 100
   CHARACTER SET US7ASCII
   NATIONAL CHARACTER SET AL16UTF16
   EXTENT MANAGEMENT LOCAL
   DATAFILE '/u01/app/oracle/oradata/ora/system01.dbf' SIZE 325M REUSE
   SYSAUX DATAFILE '/u01/app/oracle/oradata/ora/sysaux01.dbf' SIZE 325M REUSE
   DEFAULT TABLESPACE users
      DATAFILE '/u01/app/oracle/oradata/ora/users01.dbf'
      SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
   DEFAULT TEMPORARY TABLESPACE tempts1
      TEMPFILE '/u01/app/oracle/oradata/ora/temp01.dbf'
      SIZE 20M REUSE
   UNDO TABLESPACE undotbs1
      DATAFILE '/u01/app/oracle/oradata/ora/undotbs01.dbf'
      SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; 


 6.6 执行脚本

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/sqlplus/admin/pupbld.sql


重启数据库即可。

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  534462464 bytes
Fixed Size                  2230072 bytes
Variable Size             188745928 bytes
Database Buffers          335544320 bytes
Redo Buffers                7942144 bytes
Database mounted.
Database opened.
SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值