标签:rod require live dmp文件 ogre user cin repos get
初始环境为Centos7.4 Mini安装后的系统,最开始用镜像iso做为yum源,安装oracle,在静默安装的时候报错,后来用一台同样环境的系统,开启yum缓存,下载安装依赖环境,让rpm包离线下载后,传到这台服务器,在静默安装,还是失败,最后网上找了个离线安装依赖包,成功静默安装及建库,将源oracle下的用户及表空间数据迁移到新安装的oracle用户和表空间下.以后安装可以直接安装离线依赖包
安装前的准备:
#sed -i "s/HOSTNAME=localhost.localdomain/HOSTNAME=oracle-01/" /etc/sysconfig/network
# vim /etc/hosts
10.9.133.185 oracle-01
#sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
# setenforce 0
1 配置isoyum源
cat /etc/yum.repos.d/file.repo
[file]
name=file
baseurl=file:///opt
enabled=1
gpgcheck=0
2 安装依赖包
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
3 创建oinstall和dba组
/usr/sbin/groupadd oinstall /usr/sbin/groupadd dba
创建oracle用户
/usr/sbin/useradd -g oinstall -G dba oracle
设置oracle用户密码
passwd oracle
验证创建是否正确
[root@oracle-01 ~]# id oracle uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba)
4 配置内核参数
[root@docker ~]# vim /etc/sysctl.conf # System default settings live in /usr/lib/sysctl.d/00-system.conf. # To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file # # For more information, see sysctl.conf(5) and sysctl.d(5). fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 536870912 #最低:536870912,最大值:比物理内存小1个字节的值,建议超过物理内存的一半 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 = 1048576
参数的值不能小于上面的配置,这是oracle官方建议的最小值,生产环境建议调整这些参数,以优化系统性能。
修改后使之生效
/sbin/sysctl -p
修改用户限制
vim /etc/security/limits.conf #在末尾添加 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240
oracle hard stack 10240
session required /lib64/security/pam_limits.so session required pam_limits.so
在/etc/profile 文件中,使用文本编辑器或vi命令增加或修改以下内容
if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi
使之生效
source /etc/profile
5 创建安装目录
mkdir -p /u01/app/ chown -R oracle:oinstall /u01/app/ chmod -R 775 /u01/app/
配置环境变量
[oracle@oracle-01 ~]$ vim ~/.bash_profile export ORACLE_BASE=/u01/app/oracle export ORACLE_SID=dbsrv2
使之生效
source ~/.bash_profile
6 解压oracle软件
[root@oracle-01 src]# unzip linux.x64_11gR2_database_1of2.zip [root@oracle-01 src]# unzip linux.x64_11gR2_database_2of2.zip
复制响应文件模板
[oracle@oracle-01 ~]$ mkdir etc [oracle@oracle-01 ~]$ cp /usr/local/src/database/response/* /home/oracle/etc/ [oracle@oracle-01 ~]$ ls etc dbca.rsp db_install.rsp netca.rsp
设置响应文件权限
[oracle@oracle-01 ~]$ su - root [root@oracle-01 ~]# chmod 700 /home/oracle/etc/*.rsp
静默安装Oracle软件
创建oinstall和dba组
/usr/sbin/groupadd oinstall /usr/sbin/groupadd dba
创建oracle用户
/usr/sbin/useradd -g oinstall -G dba oracle
设置oracle用户密码
passwd oracle
验证创建是否正确
[root@oracle-01 ~]# id oracle uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba)
配置内核参数
[root@docker ~]# vim /etc/sysctl.conf # System default settings live in /usr/lib/sysctl.d/00-system.conf. # To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file # # For more information, see sysctl.conf(5) and sysctl.d(5). fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 536870912 #最低:536870912,最大值:比物理内存小1个字节的值,建议超过物理内存的一半 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 = 1048576
参数的值不能小于上面的配置,这是oracle官方建议的最小值,生产环境建议调整这些参数,以优化系统性能。
修改后使之生效
/sbin/sysctl -p
修改用户限制
vim /etc/security/limits.conf #在末尾添加 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240
oracle hard stack 10240
session required /lib64/security/pam_limits.so session required pam_limits.so
在/etc/profile 文件中,使用文本编辑器或vi命令增加或修改以下内容
if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi
使之生效
source /etc/profile
创建安装目录
mkdir -p /u01/app/ chown -R oracle:oinstall /u01/app/ chmod -R 775 /u01/app/
配置环境变量
[oracle@oracle-01 ~]$ vim ~/.bash_profile export ORACLE_BASE=/u01/app/oracle export ORACLE_SID=dbsrv2
使之生效
source ~/.bash_profile
解压oracle软件
[root@oracle-01 src]# unzip linux.x64_11gR2_database_1of2.zip [root@oracle-01 src]# unzip linux.x64_11gR2_database_2of2.zip
复制响应文件模板
[oracle@oracle-01 ~]$ mkdir etc [oracle@oracle-01 ~]$ cp /usr/local/src/database/response/* /home/oracle/etc/ [oracle@oracle-01 ~]$ ls etc dbca.rsp db_install.rsp netca.rsp
设置响应文件权限
[oracle@oracle-01 ~]$ su - root [root@oracle-01 ~]# chmod 700 /home/oracle/etc/*.rsp
静默安装Oracle软件
oracle.install.option=INSTALL_DB_SWONLY // 安装类型 ORACLE_HOSTNAME=oracle-01 // 主机名称(hostname查询) UNIX_GROUP_NAME=oinstall // 安装组 INVENTORY_LOCATION=/u01/app/oraInventory //INVENTORY目录(不填就是默认值) SELECTED_LANGUAGES=en,zh_CN,zh_TW // 选择语言 ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 //oracle_home ORACLE_BASE=/u01/app/oracle //oracle_base oracle.install.db.InstallEdition=EE // oracle版本 oracle.install.db.isCustomInstall=false //自定义安装,否,使用默认组件 oracle.install.db.DBA_GROUP=dba / / dba用户组 oracle.install.db.OPER_GROUP=oinstall // oper用户组 oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //数据库类型 oracle.install.db.config.starterdb.globalDBName=orcl //globalDBName oracle.install.db.config.starterdb.SID=dbsrv2 //SID oracle.install.db.config.starterdb.memoryLimit=81920 //自动管理内存的内存(M) oracle.install.db.config.starterdb.password.ALL=oracle //设定所有数据库用户使用同一个密码 SECURITY_UPDATES_VIA_MYORACLESUPPORT=false //(手动写了false) DECLINE_SECURITY_UPDATES=true //设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。PS:不管地址对不对)
开始静默安装
[oracle@oracle-01 database]$ ./runInstaller -silent -responseFile /home/oracle/etc/db_install.rsp
打开日志大致看看就是缺少依赖包
修改yum配置文件
# vi /etc/yum.conf
修改keepcache = 1
这样所有使用yum命令进行软件安装的时候,所有下载的rpm包的缓存文件都会保存在/var/cache/yum里面
待A服务器完成所有配置后,将cachedir指定的目录直接拷贝到其它待安装的服务器上,然后使用”yum -C install [软件包名]”即可使用缓存安装。(-C参数表示使用系统缓存)
然后在静默安装,还是报错
最后网上找到离线安装包,使用 for 循环 用rpm 加上 --nodeps 安装后,在静默安装,成功出现,不容易啊
记录一个小插曲,如果中间更改过这个,你需要按照卸载命令卸载一遍oracle,不然这个参数会无效
下面就是例子
卸载如下
su - root /u01/app/oraInventory/orainstRoot.sh /u01/app/oracle/product/11.2.0/db_1/root.sh
增加或修改oracle的环境变量
su - oracle vim ~/.bash_profile
#for oracle
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=dbsrv2
export ROACLE_PID=ora11g
#export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export LANG="zh_CN.UTF-8"
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export NLS_DATE_FORMAT=‘yyyy-mm-dd hh24:mi:ss‘
配置监听程序
[oracle@oracle-01 ~]$ netca /silent /responsefile /home/oracle/etc/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /home/oracle/etc/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
启动监控程序
[oracle@oracle-01 ~]$ lsnrctl start LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 01-SEP-2016 11:23:31 Copyright (c) 1991, 2009, Oracle. All rights reserved. Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.1.0 - Production System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora Log messages written to /u01/app/oracle/diag/tnslsnr/docker/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=docker)(PORT=1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 01-SEP-2016 11:23:31 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/docker/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=docker)(PORT=1521))) The listener supports no services The command completed successfully
静默dbca建库
编辑应答文件
[oracle@oracle-01 ~]$ vi etc/dbca.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "dbsrv2"
SID = "dbsrv2"
TEMPLATENAME = "General_Purpose.dbc"
CHARACTERSET = "AL32UTF8"
建库
[oracle@oracle-01 ~]$ dbca -silent -responseFile etc/dbca.rsp Enter SYS user password: Enter SYSTEM user password: sh: /bin/ksh: No such file or directory sh: /bin/ksh: No such file or directory Copying database files 1% complete 3% complete 11% complete 18% complete 26% complete 37% complete Creating and starting Oracle instance 40% complete 45% complete 50% complete 55% complete 56% complete 57% complete 60% complete 62% complete Completing Database Creation 66% complete 70% complete 73% complete 74% complete 85% complete 96% complete 100% complete Look at the log file Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl11g/orcl11g.log" for further details.
查看输出日志
[oracle@oracle-01 ~]$ cat /u01/app/oracle/cfgtoollogs/dbca/orcl11g/orcl11g.log Copying database files DBCA_PROGRESS : 1% DBCA_PROGRESS : 3% DBCA_PROGRESS : 11% DBCA_PROGRESS : 18% DBCA_PROGRESS : 26% DBCA_PROGRESS : 37% Creating and starting Oracle instance DBCA_PROGRESS : 40% DBCA_PROGRESS : 45% DBCA_PROGRESS : 50% DBCA_PROGRESS : 55% DBCA_PROGRESS : 56% DBCA_PROGRESS : 60% DBCA_PROGRESS : 62% Completing Database Creation DBCA_PROGRESS : 66% DBCA_PROGRESS : 70% DBCA_PROGRESS : 73% DBCA_PROGRESS : 85% DBCA_PROGRESS : 96% DBCA_PROGRESS : 100% Database creation complete. For details check the logfiles at: /u01/app/oracle/cfgtoollogs/dbca/orcl11g. Database Information: Global Database Name:orcl11g.us.oracle.com System Identifier(SID):dbsrv2
至此完成数据库实例的创建。
sqlplus / as sysdba;
建立导出目录(建立的目录在系统层面必须存在)并赋读写权限:
create directory exp_dir as ‘/tmpdmp‘
其中/tmpdmp 目录是存放导出数据的路径
grant read,write on directory exp_dir to ceshi;
对该路径进行授权
或者下面这行,下面这知更清楚
expdp ceshi/ceshi@dbsrv2 directory=exp_dir dumpfile=water_back.dmp logfile=water_back.log schemas=ceshi;
1、创建表空间和用户。
2、创建目录
create directory dpdata1 as ‘/tmppdm‘
grant read,write on directory dpdata1 to ganinfo;
把dmp文件复制到刚才创建的目录文件夹下(/tmppdm),这个文件夹需要自己手动创建。
3、执行impdp导入命令:
impdp ganinfo/ganinfo dumpfile=ceshi.dmp directory=dpdata1 remap_schema=ceshi:ganinfo remap_tablespace=ceshi:ganinfo full=y;
参考:
https://www.cnblogs.com/zydev/p/5827207.html
https://www.cnblogs.com/wangsaiming/p/4947151.html
内网环境下centos7.4离线安装oracle,及不同用户表空间迁移数据
标签:rod require live dmp文件 ogre user cin repos get
原文地址:https://www.cnblogs.com/shuowen/p/10661256.html