ORACLE无GUI搭建环境
下载oracle 11g
下载地址:wget http://v.yingsun.net/cobra/download/linux.x64_11gR2_database_1of2.zip
下载地址:wget http://v.yingsun.net/cobra/download/linux.x64_11gR2_database_2of2.zip
一 安装java
查看CentOS自带JDK是否已安装。yum list installed |grep java
查看yum库中的Java安装包 命令:yum -y list java 看看可安装的软件包有没有java-1.8.0-openjdk
二 检查和安装需要的rpm
yum -y install binutils compat-libstdc++ compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ glibc-devel glibc-headers ksh libaio-devel libstdc++-devel make sysstat unixODBC-devel binutils-* compat-libstdc++* elfutils-libelf* glibc* gcc-* libaio* libgcc* libstdc++* make* sysstat* unixODBC* wget unzip
三 创建用户组和用户
userdel -r oracle
groupadd -g 700 oinstall
groupadd -g 701 dba
useradd -g oinstall -G dba -u 700 oracle
passwd oracle
id oracle
四 设置ORACLE环境变量
su - oracle
vi ~/.bash_profile
export ORACLE_BASE=/u02/oracle
export ORACLE_HOME=/u02/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export NLS_LANG="american_america.AL32UTF8"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:Mi:SS"
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
//脚本方式
new_export = "export ORACLE_BASE=/u02/oracle"
echo "export ORACLE_BASE=/u02/oracle" >> ~/.bash_profile
echo "export ORACLE_HOME=/u02/oracle/product/11.2.0/dbhome_1" >> ~/.bash_profile
echo "export ORACLE_SID=orcl" >> ~/.bash_profile
bash shell:脚本中修改profile文件更新LD_LIBRARY_PATH的示例 http://blog.csdn.net/10km/article/details/51953721
source ~/.bash_profile
查看环境变量是否完成
env | grep ORA
五 创建安装目录
su - root
mkdir -p /u02/oracle
mkdir -p /u02/oracle/product/11.2.0/dbhome_1
chown -R oracle:oinstall /u02/oracle
chmod -R 775 /u02/oracle
vi /etc/oraInst.loc
inventory_loc==/home/oracle/oralnventory
inst_group=oinstall
source /etc/oralnst.loc
chown oracle:oinstall /etc/oraInst.loc
chmod 664 /etc/oraInst.loc
五 解压
unzip p10404530_112030_Linux-x86-64_1of7.zip; unzip p10404530_112030_Linux-x86-64_2of7.zip
六 复制响应文件模板
用oracle用户复制
su - oracle
mkdir /home/oracle/etc
mkdir /home/oracle/oralnventory
cp /u02/oracle/database/response/* /home/oracle/etc/
七 设置响应文件
su - root
chmod 700 /home/oracle/etc/*.rsp(注意所有者,oinstall)
八 静默安装Oracle软件
su - oracle
修改安装Oracle软件的响应文件/home/oracle/etc/db_install.rsp
#删除应答文件中的注释行(以#开头)
$ sed -i 's/^#.*$//g' *.rsp
刪除沒有內容的空行(^$)
$ sed -i '/^$/d' *.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY // 29 安装类型
ORACLE_HOSTNAME=oracle // 37 主机名称(hostname查询)
UNIX_GROUP_NAME=oinstall // 42 安装组
INVENTORY_LOCATION=/home/oracle/oraInventory //47 INVENTORY目录(不填就是默认值) 注意:这里inventory目录最好不要填写与oracle安装路径一致的目录,会报错
SELECTED_LANGUAGES=en,zh_CN,zh_TW // 78 选择语言
ORACLE_HOME=/u02/oracle/product/11.2.0/dbhome_1 // 83 oracle_home
ORACLE_BASE=/u02/oracle // 88 oracle_base
oracle.install.db.InstallEdition=EE // 99 oracle版本
oracle.install.db.isCustomInstall=false //自定义安装,否,使用默认组件
oracle.install.db.DBA_GROUP=dba // 143 dba用户组
oracle.install.db.OPER_GROUP=oinstall // 147 oper用户组
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE // 160 数据库类型
oracle.install.db.config.starterdb.globalDBName=orcl // 165 globalDBName
oracle.install.db.config.starterdb.SID=orcl // 170 SID
oracle.install.db.config.starterdb.memoryLimit=81920 // 200 自动管理内存的内存(M)
oracle.install.db.config.starterdb.password.ALL=oracle // 233 设定所有数据库用户使用同一个密码
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false // 376(手动写了false)
DECLINE_SECURITY_UPDATES=true // 385 设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。PS:不管地址对不对)
执行命令 开始默认安装
cd /u02/oracle/database
./runInstaller -ignorePrereq -silent -force -responseFile /home/oracle/etc/db_install.rsp
安向导执行俩文件
/home/oracle/oraInventory/orainstRoot.sh
/u02/oracle/product/11.2.0/dbhome_1/root.sh
九 静默配置网络
编辑netca.rsp文件
$ more /u02/oracle/database/response/netca.rsp
[GENERAL]
RESPONSEFILE_VERSION="11.2"
CREATE_TYPE="CUSTOM"
[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""typical""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
NSN_NUMBER=1
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
NSN_SERVICE={"PLSExtProc"}
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
在oracle用户下
$ORACLE_HOME/bin/netca /silent /responsefile /u02/oracle/database/response/netca.rsp
十 静默安装数据库
在oracle 用户安装。需要配置静默安装数据库响应的模板文件,也是在安装软件包中解压在database下的response 目录下的 dbca_rsp 文件,具体配置如下
vim dbca.rsp
//$ more /u02/soft/database/response/dbca.rsp
cp /u02/oracle/database/response/dbca.rsp /u02/oracle/database/response/dbca.rsp.bak
vi /u02/oracle/database/response/dbca.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "lanmao" #全局数据库的名字
SID = "orcl" # 数据库实例,根据上面的你写的SID 一样的,随便写。
TEMPLATENAME = "General_Purpose.dbc" # 这个可以是默认的模板,不会写默认的,最好是默认,
这里是我们dba 写的,所以就用上了。
SYSPASSWORD = "2011@oracle"
SYSTEMPASSWORD = "2011@oracle"
SYSMANPASSWORD = "2011@oracle"
DBSNMPPASSWORD = "2011@oracle" # 前面这四个都可以不管,默认就行
CHARACTERSET = "ZHS16GBK" #编码
NATIONALCHARACTERSET="UTF8" #编码
[createTemplateFromDB]
SOURCEDB = "iZ2zehy7gff0kpg1swp1czZ:1521:orcl"
SYSDBAUSERNAME = "system"
TEMPLATENAME = "My Copy TEMPLATE"
[createCloneTemplate]
SOURCEDB = "orcl"
TEMPLATENAME = "My Clone TEMPLATE"
[DELETEDATABASE]
SOURCEDB = "orcl"
[generateScripts]
TEMPLATENAME = "New Database"
GDBNAME = "orcl11.us.oracle.com"
[CONFIGUREDATABASE]
[ADDINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
NODELIST=
SYSDBAUSERNAME = "sys"
[DELETEINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
INSTANCENAME = "orcl11g"
SYSDBAUSERNAME = "sys"
$ORACLE_HOME/bin/dbca -silent -responseFile /db/soft/database/response/dbca.rsp
$ORACLE_HOME/bin/dbca -silent -responseFile /u02/oracle/database/response/dbca.rsp
跟踪错误sqlplus 方法
strace sqlplus / as sysdba
查看为什么出现 ORA-12547: TNS:lost contact
参考 使用Shell脚本实现自动化静默安装Oracle软件https://github.com/yoshinorim/mha4mysql-manager.git
一个表或索引或其它对象使用BUFFER CACHE,最终使用哪个CBC LATCH,由其文件号以及数据块号,进行HASH后使用指定的CBC LATCH
使用Shell脚本实现自动化静默安装Oracle软件
第一篇 静默方式安装oracle 11g 完整攻略
下载oracle 11g
下载地址:wget http://v.yingsun.net/cobra/download/linux.x64_11gR2_database_1of2.zip
下载地址:wget http://v.yingsun.net/cobra/download/linux.x64_11gR2_database_2of2.zip
一 安装java
查看CentOS自带JDK是否已安装。yum list installed |grep java
查看yum库中的Java安装包 命令:yum -y list java 看看可安装的软件包有没有java-1.8.0-openjdk
二 检查和安装需要的rpm
各个版本的检查包和版本可以看官方文档
https://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm#BHCFACHG
具体所有安装包是否已安装检查方法
rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
检查有没有31个
还能用如下方式检查,包括centos6,centos7的包
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils \
compat-libcap1 \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
libXi \
libXtst \
make \
sysstat \
unixODBC \
unixODBC-devel
如缺少相应包可用yum -y install 安装,也可以按如下方式直接把需要的所有依赖包安装上
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
网上搜索的方法也可以参考如下
yum -y install binutils compat-libstdc++ compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ glibc-devel glibc-headers ksh libaio-devel libstdc++-devel make sysstat unixODBC-devel binutils-* compat-libstdc++* elfutils-libelf* glibc* gcc-* libaio* libgcc* libstdc++* make* sysstat* unixODBC* wget unzip unixODBC-devel
还有必须下载的包
wget ftp://ftp.pbone.net/mirror/www.whiteboxlinux.org/whitebox/4/en/updates/i686/glibc-2.3.4-2.43.i686.rpm
三 创建用户组和用户
userdel -r oracle
groupadd -g 700 oinstall
groupadd -g 701 dba
useradd -g oinstall -G dba -u 700 oracle
passwd oracle
id oracle
四 设置ORACLE环境变量
su - oracle
vi ~/.bash_profile
export ORACLE_BASE=/u02/oracle
export ORACLE_HOME=/u02/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export NLS_LANG="american_america.AL32UTF8"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:Mi:SS"
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
//脚本方式初始化环境变量参考方法
new_export = "export ORACLE_BASE=/u02/oracle"
echo "export ORACLE_BASE=/u02/oracle" >> ~/.bash_profile
echo "export ORACLE_HOME=/u02/oracle/product/11.2.0/dbhome_1" >> ~/.bash_profile
echo "export ORACLE_SID=orcl" >> ~/.bash_profile
bash shell:脚本中修改profile文件更新LD_LIBRARY_PATH的示例 http://blog.csdn.net/10km/article/details/51953721
source ~/.bash_profile
查看环境变量是否完成
env | grep ORA
五 创建安装目录
su - root
mkdir -p /u02/oracle
mkdir -p /u02/oracle/product/11.2.0/dbhome_1
chown -R oracle:oinstall /u02/oracle
chmod -R 775 /u02/oracle
vi /etc/oraInst.loc
inventory_loc==/home/oracle/oraInventory
inst_group=oinstall
source /etc/oraInst.loc
chown oracle:oinstall /etc/oraInst.loc
chmod 664 /etc/oraInst.loc
五 解压安装文件
unzip p10404530_112030_Linux-x86-64_1of7.zip;
unzip p10404530_112030_Linux-x86-64_2of7.zip
六 复制响应文件模板
用oracle用户复制
su - oracle
mkdir /home/oracle/etc --放配置文件 如响应文件
mkdir /home/oracle/oraInventory --放产品目录相关文件
cp /u02/oracle/database/response/* /home/oracle/etc/
七 设置响应文件权限
su - root
chmod 700 /home/oracle/etc/*.rsp(注意所有者,oinstall)
八 静默安装Oracle软件
su - oracle
修改安装Oracle软件的响应文件/home/oracle/etc/db_install.rsp
#删除应答文件中的注释行(以#开头)
$ sed -i 's/^#.*$//g' *.rsp
刪除沒有內容的空行(^$)
$ sed -i '/^$/d' *.rsp
文件内容详细介绍
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY // 29 安装类型
ORACLE_HOSTNAME=oracle // 37 主机名称(hostname查询)
UNIX_GROUP_NAME=oinstall // 42 安装组
INVENTORY_LOCATION=/home/oracle/oraInventory //47 INVENTORY目录(不填就是默认值) 注意:这里inventory目录最好不要填写与oracle安装路径一致的目录,会报错
SELECTED_LANGUAGES=en,zh_CN,zh_TW // 78 选择语言
ORACLE_HOME=/u02/oracle/product/11.2.0/dbhome_1 // 83 oracle_home
ORACLE_BASE=/u02/oracle // 88 oracle_base
oracle.install.db.InstallEdition=EE // 99 oracle版本
oracle.install.db.isCustomInstall=false //自定义安装,否,使用默认组件
oracle.install.db.DBA_GROUP=dba // 143 dba用户组
oracle.install.db.OPER_GROUP=oinstall // 147 oper用户组
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE // 160 数据库类型
oracle.install.db.config.starterdb.globalDBName=orcl // 165 globalDBName
oracle.install.db.config.starterdb.SID=orcl // 170 SID
oracle.install.db.config.starterdb.memoryLimit=81920 // 200 自动管理内存的内存(M)
oracle.install.db.config.starterdb.password.ALL=oracle // 233 设定所有数据库用户使用同一个密码
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false // 376(手动写了false)
DECLINE_SECURITY_UPDATES=true // 385 设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。PS:不管地址对不对)
实际产品库详单参考db_install.rsp内容
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=
ORACLE_HOSTNAME=iZ2zehy7gff0kpg1swp1czZ
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/home/oracle/oraInventory
SELECTED_LANGUAGES=en
ORACLE_HOME=/u02/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/u02/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.CLUSTER_NODES=
"/home/oracle/etc/db_install.rsp" 53L, 2500C
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=
ORACLE_HOSTNAME=iZ2zehy7gff0kpg1swp1czZ
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/home/oracle/oraInventory
SELECTED_LANGUAGES=en
ORACLE_HOME=/u02/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/u02/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=
oracle.install.db.racOneServiceName=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl11g
oracle.install.db.config.starterdb.SID=orcl11g
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=400
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=oracle
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/u02/oracle/oradata/
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/u02/oracle/flash_recovery_area/
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
COLLECTOR_SUPPORTHUB_URL=
oracle.installer.autoupdates.option=
oracle.installer.autoupdates.downloadUpdatesLoc=
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
执行命令 开始默认安装
cd /u02/oracle/database
./runInstaller -ignorePrereq -showProgress -silent -responseFile /home/oracle/etc/db_install.rsp 这种方法不显示日志
./runInstaller -ignorePrereq -showProgress -silent -force -responseFile /home/oracle/etc/db_install.rsp
./runInstaller -silent -force -responseFile /home/oracle/etc/db_install.rsp
这时可以看安装日志
INFO: Number of threads for fast copy :1
注意问题点
这里在centos7上安装oracle11g时,不论11.1.0.1还是 11.2.0.4 都会报错
String: Error in invoking target 'agent nmhs' of makefile '/u02/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk'.
这个错误相当于图形界面安装时遇到的错误,但图形界面安装遇到错误,会停止,且提供重试的按钮,静默安装就不成,具体解决方法可以参考
http://www.jb51.net/article/129719.htm《CentOS 7.4下安装Oracle 11.2.0.4数据库的方法》 这里需要编辑安装文件
按向导执行俩文件
/home/oracle/oraInventory/orainstRoot.sh
/u02/oracle/product/11.2.0/dbhome_1/root.sh
九 静默配置网络
编辑netca.rsp文件
$ more /home/oracle/etc/netca.rsp
[GENERAL]
RESPONSEFILE_VERSION="11.2"
CREATE_TYPE="CUSTOM"
[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""typical""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
NSN_NUMBER=1
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
NSN_SERVICE={"PLSExtProc"}
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
在oracle用户下
$ORACLE_HOME/bin/netca /silent /responsefile /home/oracle/database/response/netca.rsp
十 静默安装数据库
在oracle 用户安装。需要配置静默安装数据库响应的模板文件,也是在安装软件包中解压在database下的response 目录下的 dbca_rsp 文件,具体配置如下
//$ more /u02/soft/database/response/dbca.rsp
vi /home/oracle/etc/dbca.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl11g.localdomain"
SID = "orcl11g"
TEMPLATENAME = "General_Purpose.dbc"
DATAFILEDESTINATION=/u02/oracle/oradata
RECOVERYAREADESTINATION=/u02/oracle/flash_recovery_area
CHARACTERSET = "AL32UTF8"
NATIONALCHARACTERSET= "AL16UTF16"
DB_UNIQUE_NAME = "orcl11g"
LISTENERS=LISTENER
TOTALMEMORY = "700"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
执行安装
$ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/etc/dbca.rsp
--/u02/oracle/database/response/dbca.rsp
十一 删除方法
数据库安装成功后,要删除执行的命令
先删除数据库
/home/oracle/database/dbca -silent -deleteDatabase -sourcedb orcl11g -sid orcl11g -sysDBAUserName system -sysDBAPassword oracle
没安装成功时删除数据库和软件方法
删除/u02/oracle/oradata目录下对应数据库文件夹
删除/u02/oracle/flash_recovery_area 目录下对应数据库文件夹
最重要/etc/oratab 删除里面最后的对应数据库的记录
--删除 vi /home/oracle/oraInventory/ContentsXML/inventory.xml
root用户
清空swap空间,删除数据文件和oracle相应目录
swapoff -a && swapon -a
rm -fr /u02/oracle/oradata
rm -fr /u02/oracle/flash_recovery_area
rm -fr /home/oracle/oraInventory
rm -fr /u02/oracle/product/11.2.0/dbhome_1
删除配置文件内容
vi /etc/oratab
--vi /home/oracle/oraInventory/ContentsXML/inventory.xml
--sed -i '/^
mkdir -p /u02/oracle/product/11.2.0/dbhome_1
chown -R oracle:oinstall /u02/oracle
chmod -R 775 /u02/oracle
mkdir -p /u02/oracle/oradata
mkdir -p /u02/oracle/flash_recovery_area
chown -R oracle:oinstall /u02/oracle/oradata
chmod -R 775 /u02/oracle/oradata
su - oracle
mkdir /home/oracle/oraInventory
/u02/oracle/oradiag_oracle/diag/clients/user_oracle/host_2133379358_76/alert
跟踪错误sqlplus 方法
strace sqlplus / as sysdba
strace -f -o /tmp/sqlplus.log sqlplus / as sysdba
查看为什么出现 ORA-12547: TNS:lost contact
select open_mode from v$database;
遇到的问题
问题1
在静默安装oracle的时候,在安装软件以后,进入sqlplus后,总是报TNS connect lost,这时就在网上查看了这个错误对应问题,其中说是
bin目录里oracle执行文件大小为0,后来就反复装,发现装的时候果然系统装到link oracle的时候就不动了,最后看日志的时候看这里最终
报错。然后就在日志里查看了对应的错误。和日志里遇到的第一个错误。
其实判断这个题很容易,重要的是看日志
日志在安装时,已经输出了具体位置和文件名,打开后就能看到。里面发现的第一个报错信息
INFO: collect2: error: ld returned 1 exit status
make[1]: *** [/u02/oracle/product/11.2.0/dbhome_1/sysman/lib/emdctl] Error 1
make: *** [emdctl] Error 2
INFO: End output from spawned process.
INFO: ----------------------------------
INFO: Exception thrown from action: make
Exception Name: MakefileException
Exception String: Error in invoking target 'agent nmhs' of makefile '/u02/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk'. See '/home/oracle/oraInventory/logs/installActions2017-12-12_04-48-00PM.log' for details.
Exception Severity: 1
然后根据网上的提示就是在ins_emagent里加 -lnnet11
然后为让这些字节是0的文件生效,就执行了bin目录里的relink all
最后oracle文件就生成了,且在进入sqlplus就不报tns的错误了,最后说的是连接一个正常实例的问题。
打印日志的时候,在这个位置会等很长时间
INFO: - Linking Oracle
rm -f /u02/oracle/product/11.2.0/dbhome_1/rdbms/lib/oracle
INFO: gcc -o /u02/oracle/product/11.2.0/dbhome_1/rdbms/lib/oracle -m64 -z noexecstack -L/u02/oracle/product/11.2.0/dbhome_1/rdbms/lib/ -L/u02/oracle/product/11.2.0/dbhome_1/lib/ -L/u02/oracle/product/11.2.0/dbhome_1/lib/stubs/ -Wl,-E /u02/oracle/product/11.2.0/dbhome_1/rdbms/lib/opimai.o /u02/oracle/product/11.2.0/dbhome_1/rdbms/lib/ssoraed.o /u02/oracle/product/11.2.0/dbhome_1/rdbms/lib/ttcsoi.o -Wl,--whole-archive -lperfsrv11 -Wl,--no-whole-archive /u02/oracle/product/11.2.0/dbhome_1/lib/nautab.o /u02/oracl
INFO: e/product/11.2.0/dbhome_1/lib/naeet.o /u02/oracle/product/11.2.0/dbhome_1/lib/naect.o /u02/oracle/product/11.2.0/dbhome_1/lib/naedhs.o /u02/oracle/product/11.2.0/dbhome_1/rdbms/lib/config.o -lserver11 -lodm11 -lcell11 -lnnet11 -lskgxp11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lclient11 -lvsn11 -lcommon11 -lgeneric11 -lknlopt `if /usr/bin/ar tv /u02/oracle/product/11.2.0/dbhome_1/rdbms/lib/libknlopt.a | grep xsyeolap
......
`cat /u02/oracle/product/11.2.0/db
INFO: home_1/lib/sysliblist` -Wl,-rpath,/u02/oracle/product/11.2.0/dbhome_1/lib -lm `cat /u02/oracle/product/11.2.0/dbhome_1/lib/sysliblist` -ldl -lm -L/u02/oracle/product/11.2.0/dbhome_1/lib
orapwd FILE=orapwdORCL11g.pwd PASSWORD=welcome1 ENTRIES=30
问题2 创建数据库时报错
排错方法 看建立数据库时alert方法
[oracle@iZ2zehy7gff0kpg1swp1czZ ~]$ cd $ORACLE_BASE/diag/rdbms/orcl11g/orcl11g/trace
[oracle@iZ2zehy7gff0kpg1swp1czZ trace]$ ls -alcr | grep alert
-rw-r----- 1 oracle oinstall 64209 Dec 14 14:45 alert_orcl11g.log
[oracle@iZ2zehy7gff0kpg1swp1czZ trace]$ ls -alcr | grep alert
在其中找到了pfile文件
/u02/oracle/cfgtoollogs/dbca/orcl11g/initorcl11gTemp.ora
startup nomount pfile=/u02/oracle/cfgtoollogs/dbca/orcl11g/initorcl11gTemp.ora;
/u02/oracle/diag/rdbms/orcl11g/orcl11g/trace/orcl11g_ora_16270.trc
要根据pfile生成spfile,数据库就能启动到open了
create spfile from pfile='/u02/oracle/cfgtoollogs/dbca/orcl11g/initorcl11gTemp.ora'
create spfile from pfile='$ORACLE_HOME/dbs/initorcl11g.ora'
问题3 手工建库时的问题
根据文档手工创建数据库,但输入创建语句后,系统提示如下错误
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-01501: CREATE DATABASE failed
ORA-01519: error while processing file '?/rdbms/admin/dtxnspc.bsq' near line 5
ORA-00604: error occurred at recursive SQL level 1
ORA-30012: undo tablespace 'UNDOTBS1' does not exist or of wrong type
这个提示实际很明显,但特别注意的是要保证参数文件里的回退表空间名字和create database语句
里的表空间名字要一样,而不是和create database里的回退数据文件名一样,这很重要,这可以保证
后面执行脚本时没有莫名其妙的错误。
手工建库的过程如下
1 删除已有数据库
rm -fr oradata/orcl11g/*.*
rm -fr fast_recovery_area/orcl11g/control02.ctl
2
orapwd FILE=orapwdSORCL.pwd PASSWORD=oracle ENTRIES=30
CREATE SPFILE='spfile.ora' FROM
PFILE='init.ora';
CREATE DATABASE orcl11g
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u02/oracle/oradata/orcl11g/redo01.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u02/oracle/oradata/orcl11g/redo02.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u02/oracle/oradata/orcl11g/redo03.log') SIZE 100M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u02/oracle/oradata/orcl11g/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/u02/oracle/oradata/orcl11g/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE '/u02/oracle/oradata/orcl11g/users01.dbf'
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u02/oracle/oradata/orcl11g/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs --undotbs 必须和参数文件中指定名字一样
DATAFILE '/u02/oracle/oradata/orcl11g/UNDOTBS_01.dbf' --UNDOTBS_01没事随便取名
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
rm -fr /tmp/logsql.txt
spool /tmp/logsql.txt --这样可以执行sql脚本后的日志
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
spool off
克隆安装数据库软件
在一台机器上克隆安装第二个oracle 软件
1增加swap分区
dd if=/dev/zero of=/home/swap1 bs=612 count=612000
mkswap /home/swap1
swapon /home/swap1
2复制dbhome_1到新位置 cp -r /u02/oracle/product/11.2.0/dbhome_1 /u03_clone/oracle/product/11.2.0/dbhome_1
3chown -R oracle:oinstall /u03_clone/oracle
su - oracle
4 登记复制后的信息命令
cd /u03_clone/oracle/product/11.2.0/dbhome_1/clone/bin
perl clone.pl ORACLE_BASE=/u03_clone/oracle ORACLE_HOME=/u03_clone/oracle/product/11.2.0/dbhome_1 ORACLE_HOME_NAME=OraDb11g_home_clone
5 验证是否加入产品列表目录,软件是否安装成功
vi /home/oracle/oraInventory/ContentsXML/inventory.xml
dgbroker
1:主库配置listener.ora文件和tnsnames.ora文件,添加GLOBAL_DBNAME参数,重启监听器,所有的节点都需要配置
cat $ORACLE_HOME/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = PRIMARY)
(ORACLE_HOME = /u02/oracle/product/11.2.0/dbhome_1)
(SID_NAME = orcl11g)
)
(SID_DESC =
(GLOBAL_DBNAME = PRIMARY_DGMGRL)
(ORACLE_HOME = /u02/oracle/product/11.2.0/dbhome_1)
(SID_NAME = orcl11g)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = iZ2zehy7gff0kpg1swp1czZ)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /u02/oracle
cat $ORACLE_HOME/network/admin/tnsnames.ora
PRIMARY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = iZ2zehy7gff0kpg1swp1czZ)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl11g.localdomain)
)
)
PHYSICAL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = iZ2zehy7gff0kpg1swp1czZ)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl11g.localdomain)
)
)
复制主库listener和tnsname到备库
cd /u02/oracle/product/11.2.0/dbhome_1/network/admin
cp listener.ora tnsnames.ora /u03_clone/oracle/product/11.2.0/dbhome_1/network/admin/
备库上的listener和tnsname
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = PHYSICAL)
(ORACLE_HOME = /u03_clone/oracle/product/11.2.0/dbhome_1)
(SID_NAME = sorcl11g)
)
(SID_DESC =
(GLOBAL_DBNAME = PHYSICAL_DGMGRL)
(ORACLE_HOME = /u03_clone/oracle/product/11.2.0/dbhome_1)
(SID_NAME = sorcl11g)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = iZ2zehy7gff0kpg1swp1czZ)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /u02/oracle
备库的tnsname
PHYSICAL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = iZ2zehy7gff0kpg1swp1czZ)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl11g.localdomain)
)
)
PRIMARY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = iZ2zehy7gff0kpg1swp1czZ)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl11g.localdomain)
)
)
注意 这里端口号和主库的端口不应一致,因为此时环境是一个节点上有两个ORACLE产品两个ORACLE数据库
2:设置DG_BROKER_START参数,所有的节点都需要配置
2.1基本配置
alter system set db_unique_name='PRIMARY' scope=spfile;
alter system set standby_file_management ='AUTO';
alter database add standby logfile group 11 '/u02/oracle/oradata/orcl11g/standbylog/standby11.log' size 50m;
alter database add standby logfile group 12 '/u02/oracle/oradata/orcl11g/standbylog/standby12.log' size 50m;
alter database add standby logfile group 13 '/u02/oracle/oradata/orcl11g/standbylog/standby13.log' size 50m;
alter database add standby logfile group 14 '/u02/oracle/oradata/orcl11g/standbylog/standby14.log' size 50m;
2.2主库归档
shutdown immediate;
startup mount;
alter system set log_archive_dest_1='location=/u02/oracle/oradata/orcl11g/archivelog';
alter database archivelog;
主库启动broker
show parameter dg_broker_start;
!ps -ef |grep dmon
alter system set dg_broker_start=TRUE;
!ps -ef |grep dmon
alter database open;
在主库重新生成pfile create pfile from spfile;
2.3 备份主库:
a.rman target /
b.backup database;
2.4 在备库上克隆主库:
a.cd /u02/oracle/product/11.2.0/dbhome_1/dbs
cp initorcl11g.ora orapworcl11g /u03_clone/oracle/product/11.2.0/dbhome_1/dbs/
修改备库pfile上的db_unique_name=PHYSICAL
因为在同一台机器的不同位置安装了另一个oracle软件,所以还要设置数据存放位置的参数
su - oracle
mkdir -p /u03_clone/oracle/oradata/orcl11g/archivelog
mkdir -p /u03_clone/oracle/flash_recovery_area
mkdir -p /u03_clone/oracle/admin/orcl11g/adump
如果主端与备端目录不同继续修改参数,在两端的pfile文件中要添加,当然如果相同也可以添加:
*.log_file_name_convert='/u02/oracle/oradata/orcl11g/','/u03_clone/oracle/oradata/orcl11g'
*.db_file_name_convert='/u02/oracle/oradata/orcl11g/','/u03_clone/oracle/oradata/orcl11g'
要在同一台机器上启动另一产品的数据库,必须先启动不同的listener,然后启动俩数据库
同一机器上启动不同产品的listener 必须要有TNS_ADMIN
打开窗口1 export TNS_ADMIN=/u02/oracle/product/11.2.0/dbhome_1/network/admin 主库listener
打开窗口2 export TNS_ADMIN=/u03_clone/oracle/product/11.2.0/dbhome_1/network/admin 备库listener
b.启动数据库到nomount:
在窗口1
export ORACLE_SID=orcl11g
echo $ORACLE_SID
sqlplus / as sysdba
startup open pfile=/u02/oracle/product/11.2.0/dbhome_1/dbs
在窗口2
export ORACLE_SID=sorcl11g
echo $ORACLE_SID
sqlplus / as sysdba
startup nomount pfile=/u03_clone/oracle/product/11.2.0/dbhome_1/dbs
在备库还得再创建一个空的新的数据库
CREATE DATABASE orcl11g
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u03_clone/oracle/oradata/orcl11g/redo01.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u03_clone/oracle/oradata/orcl11g/redo02.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u03_clone/oracle/oradata/orcl11g/redo03.log') SIZE 100M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u03_clone/oracle/oradata/orcl11g/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/u03_clone/oracle/oradata/orcl11g/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE '/u03_clone/oracle/oradata/orcl11g/users01.dbf'
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u03_clone/oracle/oradata/orcl11g/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/u03_clone/oracle/oradata/orcl11g/UNDOTBS_01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
c.登陆rman:
rman target sys/oracle@PRIMARY auxiliary sys/oracle@PHYSICAL
rman target system/oracle@PHYSICAL auxiliary system/oracle@PRIMARY
d.开始克隆:
问题 重点看
rman target sys/oracle@PRIMARY auxiliary sys/oracle@PHYSICAL
这里连接auxiliary库的时候,死活又在那报无效用户名密码的问题,具体提示如下
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-01017: invalid username/password; logon denied
解决问题是想在一台机器上复制一个已经可以的oracle软件产品,到另一个目录,重新安装一个oracle软件,特别是
复制了已安好的ORACLE_HOME下的dbs下的所有文件后,发现initorcl.ora需要修改成initsorcl.ora,这边新安得软件对应的库
才能识别,所以同意密码文件也应该是orapwsorcl 而不是直接从原来的库拿过来的密码文件对应的数据库名,原库密码文件是
orapworcl 要改成oraopworcl 数据库名和原数据库名一样对应密码文件名也要修改。
另外注意 远程连接rman时,system没有权限访问rman所以也会报无效用户名密码问题,所以只能用sys用户远程连接rman
duplicate target database for standby nofilenamecheck from active database;
如果数据文件与重做日志文件目录相同,要添加 nofilenamecheck ,否则不需要添加
查看日志
vi /u03_clone/oracle/diag/rdbms/physical/orcl11g/trace/alert_orcl11g.log
vi /u03_clone/oracle/diag/rdbms/physical/sorcl11g/trace/alert_sorcl11g.log
vi /u02/oracle/diag/rdbms/primary/orcl11g/trace/alert_orcl11g.log
/u02/oracle/diag/rdbms/primary/orcl11g/trace/drcorcl11g.log
startup nomount pfile=/u03_clone/oracle/product/11.2.0/dbhome_1/dbs/initorcl11g.ora
startup upgrade pfile=/u03_clone/oracle/product/11.2.0/dbhome_1/dbs/initorcl11g.ora
startup open pfile=/u03_clone/oracle/product/11.2.0/dbhome_1/dbs/initorcl11g.ora
@/u03_clone/oracle/product/11.2.0/dbhome_1/rdbms/admin/catalog.sql
@/u03_clone/oracle/product/11.2.0/dbhome_1/rdbms/admin/catproc.sql
@/u03_clone/oracle/product/11.2.0/dbhome_1/rdbms/admin/catupgrd.sql
startup open pfile=/u02/oracle/product/11.2.0/dbhome_1/dbs/initorcl11g.ora
测试远程连接备库
export ORACLE_SID=sorcl11g
export ORACLE_HOME=/u03_clone/oracle/product/11.2.0/dbhome_1
export TNS_ADMIN=/u03_clone/oracle/product/11.2.0/dbhome_1/network/admin/
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
tnsping DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=iZ2zehy7gff0kpg1swp1czZ)(PORT=1522)))(CONNECT_DATA=(SERVICE_NAME=PHYSICAL.localdomain)(CID=(PROGRAM=oracle)(HOST=iz2zehy7gff0kpg1swp1czz)(USER=oracle))))
(DESCRIPTION= (ADDRESS=(PROTOCOL=TCP)(HOST=test01.cyou.com) (PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=stest_DGMGRL) (INSTANCE_NAME=test)(SERVER=DEDICATED)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=iZ2zehy7gff0kpg1swp1czZ)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=PHYSICAL.localdomain)(INSTANCE_NAME=sorcl)(SERVER=DEDICATED)))
cd $ORACLE_HOME/bin
./sqlplus / as sysdba
./lsnrctl status
startup open pfile=/u03_clone/oracle/product/11.2.0/dbhome_1/dbs/initorcl11g.ora
./sqlplus system/welcome1@PHYSICAL
rman target /
测试远程连接主库
export ORACLE_SID=orcl11g
export ORACLE_HOME=/u02/oracle/product/11.2.0/dbhome_1
export TNS_ADMIN=/u02/oracle/product/11.2.0/dbhome_1/network/admin/
cd $ORACLE_HOME/bin
./sqlplus / as sysdba
./lsnrctl status
startup open pfile=/u02/oracle/product/11.2.0/dbhome_1/dbs/initorcl11g.ora
./sqlplus system/oracle@PRIMARY
2.5:创建并启用配置文件
dgmgrl sys/oracle@PRIMARY
create configuration dgc as primary database is PRIMARY connect identifier is PRIMARY;
add database PHYSICAL as connect identifier is PHYSICAL maintained as physical;
add database 'standby',这儿的standby是指database的db_unique_name,而AS CONNECT IDENTIFIER IS 'standby' 这里的standby是指
tnsname.ora 连接到standby database的net service name。
还可以这样
alter system set log_archive_dest_2='SERVICE=ocrls ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ocrls' scope=spfile;
=》alter system set log_archive_dest_2='SERVICE=PHYSICAL LGWR ASYNC NOAFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PHYSICAL' scope=spfile;
service=physical, LGWR ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300db_unique_name=physical net_timeout=30, valid_for=(all_logfiles,primary_role)
--alter system set log_archive_dest_2='SERVICE=PHYSICAL lgwr async noaffirm delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 net_timeout=30, VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PHYSICAL'
enable configuration
show configuration [verbose];
alter system set fal_client=
主库该参数
alter system set fal_client='PRIMARY';
ALTER system set fal_server='PHYSICAL';
备库该参数
alter system set fal_client='PHYSICAL';
alter system set fal_server='PRIMARY';
这次遇到的问题是在安装了oracle软件后,再创建数据库时,特别最后执行catproc.sql时怎么都执行不完,还老报错
关闭数据库重启open后,还说要按upgrade方式打开数据库,显然catproc.sql未完全执行完,最后发现原因实际是数据库内存不足
在运行脚本时,速度很慢,而且free -mh查看内存只有几十M可用,于是,关闭占用内存的应用,重新执行脚本很快就执行好了,而且
可以顺利启动到open状态
http://blog.51cto.com/ylw6006/686900
SQL> alter system set LOCAL_LISTENER='(ADDRESS = (PROTOCOL = TCP)(HOST = iz2zehy7gff0kpg1swp1czz)(PORT = 1521))' scope=spfile;
SQL> alter system set LOCAL_LISTENER='(ADDRESS = (PROTOCOL = TCP)(HOST = iz2zehy7gff0kpg1swp1czz)(PORT = 1522))' scope=spfile;
在备库上克隆主库
https://www.cnblogs.com/vijayfly/archive/2015/12/16/5051614.html oracle11G使用DGbroker创建dg
standby上SRL完全等同与primary上的ORL,在primary发生日志切换时,Remote File System(RFS)进程把primary上的ORL写到standby的SRL,同时standby归档上一个SRL
log_archive_dest_20
解决问题
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
这个错误最大的问题是 一个节点上安了两个oracle软件,在启动第二个oracle软件时,环境变量ORACLE_HOME还是第一个oracle软件的
,所以启动数据库时,是在环境变量1的基础上启动的数据库,造成启动时数据库会用到错误的环境变量ORACLE_HOME,最终启动虽然
正常,但远程连接时就报上面的错误。sqlplus system/oracle@PHYSICAL
另外出现 shared memory realm does not exist的原因还有可能是虚拟机物理内存不足造成
重启时的日志报错
db_recovery_file_dest_size of 4182 MB is 0.00% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Mon Jan 29 08:19:50 2018
Starting background process CJQ0
Mon Jan 29 08:19:50 2018
CJQ0 started with pid=30, OS id=10515
Mon Jan 29 08:20:00 2018
ORA-1652: unable to extend temp segment by 128 in tablespace TEMPTS1
Errors in file /u02/oracle/diag/rdbms/primary/orcl11g/trace/orcl11g_j003_10529.trc:
ORA-12012: error on auto execute of job "SYS"."BSLN_MAINTAIN_STATS_JOB"
ORA-01652: unable to extend temp segment by 128 in tablespace TEMPTS1
ORA-06512: at "DBSNMP.BSLN_INTERNAL", line 2073
log_archive_dest_1 /u02/oracle/oradata/orcl11g/archivelog
db_recovery_file_dest /u02/oracle/fast_recovery_area
FAST_START_MTTR_TARGET
standy_archive_dest ?/dbs_arch 能说明有dataguard么
主库总是停机
ORA-00445: background process "SMCO" did not start after 120 seconds
Tue Feb 13 02:52:18 2018
Suspending MMON action 'Process staged incidents' for 82800 seconds
Tue Feb 13 03:00:25 2018
Errors in file /u02/oracle/diag/rdbms/primary/orcl11g/trace/orcl11g_pmon_27930.trc:
ORA-00445: background process "SMCO" did not start after 120 seconds
Tue Feb 13 03:01:37 2018
Restarting dead background process SMCO
Tue Feb 13 03:05:34 2018
Errors in file /u02/oracle/diag/rdbms/primary/orcl11g/trace/orcl11g_qmnc_28070.trc (incident=34271):
ORA-00445: background process "q003" did not start after 120 seconds
Tue Feb 13 03:14:56 2018
Errors in file /u02/oracle/diag/rdbms/primary/orcl11g/trace/orcl11g_pmon_27930.trc (incident=34280):
ORA-00445: background process "SMCO" did not start after 120 seconds
Tue Feb 13 03:28:02 2018
Errors in file /u02/oracle/diag/rdbms/primary/orcl11g/trace/orcl11g_pmon_27930.trc:
ORA-00445: background process "SMCO" did not start after 120 seconds
Tue Feb 13 03:30:21 2018
Warning: VKTM detected a time drift.
Tue Feb 13 03:30:57 2018
Time drifts can result in an unexpected behavior such as time-outs. Please check trace file for more details.
这实际是数据库主机的内存不够导致相应进程在规定时间起不来,造成数据库停机。每次都要startup
ORA-01665: control file is not a standby control file
select controlfile_type from v$database;
问题2 跳归档解决GAP问题 重点看
日志无法应用
在搭建了dataguard以后,我们需要判断备库是否能正常接收主库的日志,以及是否能正常应用传送来的日志。并且在日常维护中也需要经常监控
主备是否一致。这次对某套dataguard环境巡检的时候,发现了主备库不一致,存在间隙的情况。
在主库和备库分别使用如下查询查看应用日志的具体时间和日志号
SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME
FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
发现主库和备库显示出的日志数量不一致
查看备库是否有GAP
SQL> select * from v$archive_gap;
THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#
---------- ------------- --------------
1 24 30
从上面结果发现,备库从24号到30号日志都缺失。
备库查看RFS接收日志和MRP应用日志同步主库情况
select process, sequence#, status, delay_mins from v$managed_standby;
MRP0 24 WAIT_FOR_GAP
说明这里 MRP0只应用日志到24,正好说明备库和主库是有gap的。而且备库有gap时,gap后面的日志只能接收,但不能应用
备库执行,于是查看备库是否应用接收的日志
SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG
ORDER BY SEQUENCE#;
从结果(条件限时未对结果截图)看目前这个备库是从31号日志接收日志的。且无法应用
要想让主库和备库归档一致,应用的日志也一致,可以把缺少的日志从主库拷贝到从库,具体方法看
http://blog.itpub.net/29500582/viewspace-1308247/
但发现主库没有了GAP的日志,所以只能用基于SCN不完全恢复的方法
参考查看归档进程状态 http://blog.csdn.net/wll_1017/article/details/9699631《dg 备库归档位置不一致》
跳归档具体方法
1主备库都执行
SELECT CURRENT_SCN FROM V$DATABASE;
备库SCN 1112907 主库SCN 1817052
注意 select scn_to_timestamp(1112907) scn from dual; 可以用如上方法查看SCN对应的时间
2主库上
rman target /
BACKUP INCREMENTAL FROM SCN 1112907 DATABASE FORMAT '/home/oracle/backup_stage/increment_backup_%U_%T' tag 'FORSTANDBY';
就是备份从备库没追平的时间到现在的增量备份
3在备库恢复
rman target /
catalog start with '/home/oracle/backup_stage/increment_backup'; 登记所有increment_backup开头的备份到备份目录
recover database; 恢复增量备份的数据 可以用 noredo 加速恢复
recover managed standby database disconnect from session; 最后再备库开启应用恢复的进程,让备库和主库完全一致
参考 http://www.linuxidc.com/Linux/2016-08/134300.htm
查看dataguard状态
select MESSAGE,TIMESTAMP from v$dataguard_status
order by TIMESTAMP;
另外还可以查询备库,查看从主库接收的日志
SQL> SELECT THREAD#, SEQUENCE#, FIRST_CHANGE#, NEXT_CHANGE# FROM V$ARCHIVED_LOG;
查看备库上的 standby log
SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;
gap都解决了还总是停机
ARC1: Archive log rejected (thread 1 sequence 75) at host 'PHYSICAL'
FAL[server, ARC1]: FAL archive failed, see trace file.
ARCH: FAL archive failed. Archiver continuing
ORACLE Instance orcl11g - Archival Error. Archiver continuing.
Fri Feb 23 15:30:08 2018
看归档日志 找到出错时间时对应的arc的trace
ll -tr /u02/oracle/diag/rdbms/primary/orcl11g/trace/
vi /u02/oracle/diag/rdbms/primary/orcl11g/trace/orcl11g_arc3_5025.trc
Detailed OCI error val is 1017 and errmsg is 'ORA-01017: invalid username/password; logon denie
SQL> select process, sequence#, status, delay_mins from v$managed_standby;
PROCESS SEQUENCE# STATUS
--------------------------- ---------- ------------------------------------
DELAY_MINS
----------
ARCH 56 CLOSING
0
ARCH 0 CONNECTED
0
ARCH 0 CONNECTED
0
PROCESS SEQUENCE# STATUS
--------------------------- ---------- ------------------------------------
DELAY_MINS
----------
ARCH 55 CLOSING
0
RFS 0 IDLE
0
RFS 0 IDLE
0
PROCESS SEQUENCE# STATUS
--------------------------- ---------- ------------------------------------
DELAY_MINS
----------
RFS 0 IDLE
0
RFS 60 IDLE
0
MRP0 24 WAIT_FOR_GAP
0
Log_ArchiveMinSucceedDest
Warning: VKTM detected a time drift.
Sat Feb 24 14:37:09 2018
Time drifts can result in an unexpected behavior such as time-outs. Please check trace file for more details.
show database verbose physical;
in physical
edit database physical set property ArchiveLagTarget='0';
edit database physical set property LogArchiveMaxProcesses='4';
edit database physical set property LogArchiveMinSucceedDest='1';
edit database primary set property ArchiveLagTarget='0';
edit database primary set property LogArchiveMaxProcesses='4';
edit database primary set property LogArchiveMinSucceedDest='1';
in primary
edit database primary set property DbFileNameConvert='/u03_clone/oracle/oradata/orcl11g/,/u02/oracle/oradata/orcl11g/';
edit database primary set property LogFileNameConvert='/u03_clone/oracle/oradata/orcl11g/,/u02/oracle/oradata/orcl11g/';
alter system set DG_BROKER_START=false scope=both
alter system set DG_BROKER_START=true scope=both
alter system set log_file_name_convert='/u03_clone/oracle/oradata/orcl11g/,/u02/oracle/oradata/orcl11g/' scope=both;
show database verbose physical;
select database_role from v$database;
问题3 重点看
启动过程中报错Fatal NI connect error 12514, connecting to:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=iZ2zehy7gff0kpg1swp1czZ)(PORT=1522)))(CONNECT_DATA=(SERVICE_NAME=physical_DGB.localdomain)(CID=(PROGRAM=oracle)(HOST=iz2zehy7gff0kpg1swp1czz)(USER=oracle))))
VERSION INFORMATION:
TNS for Linux: Version 11.2.0.4.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.4.0 - Production
Time: 06-MAR-2018 08:35:17
Tracing not turned on.
Tns error struct:
ns main err code: 12564
TNS-12564: TNS:connection refused
ns secondary err code: 0
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
最终发现是备库上的监听端口不是1521 而是1522 所以怎么也连不上远端的备库
edit database physical set property StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=iz2zehy7gff0kpg1swp1czz)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=PHYSICAL_DGMGRL.localdomain)(INSTANCE_NAME=sorcl11g)(SERVER=DEDICATED)))'
我重新复制的主库的密码文件到备库,现在主库启动不会报之前连接不上的问题了,在备库查询日志发现所有日志也能应用成功,
但只要用dgbroker显示数据库信息时,数据库就会很慢,卡在Apply Lag那里很长很长时间,最后才会出现SUCCESS的结果。
但远程连接上去的操作都很慢,日志看了,不是很懂,还请大侠帮助 上面问题应该就是端口号该对了(1522)以后,系统内存不够导致
[oracle@iz2zehy7gff0kpg1swp1czz ~]$ dgmgrl sys/oracle
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show database physical;
Database - physical
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 5 minutes 9 seconds (computed 24 seconds ago)
Apply Lag: 5 minutes 9 seconds (computed 53 seconds ago)
Apply Rate: (unknown)
Real Time Query: OFF
Instance(s):
sorcl11g
Database Status:
SUCCESS
数据库启动主库后报的alert日志错误
启动以后的日志
ALTER DATABASE OPEN
Data Guard Broker initializing...
Data Guard Broker initialization complete
Data Guard: verifying database primary role...
Starting Data Guard Broker (DMON)
Wed Mar 14 14:31:59 2018
INSV started with pid=21, OS id=11910
Wed Mar 14 14:32:02 2018
NSV1 started with pid=22, OS id=11918
Wed Mar 14 14:32:10 2018
RSM0 started with pid=23, OS id=11926
Wed Mar 14 14:32:10 2018
Data Guard: version check completed
Beginning crash recovery of 1 threads
Started redo scan
Completed redo scan
read 230 KB redo, 84 data blocks need recovery
Started redo application at
Thread 1: logseq 140, block 596
Recovery of Online Redo Log: Thread 1 Group 2 Seq 140 Reading mem 0
Mem# 0: /u02/oracle/oradata/orcl11g/redo02.log
Completed redo application of 0.15MB
Completed crash recovery at
Thread 1: logseq 140, block 1057, scn 3787549
84 data blocks read, 84 data blocks written, 230 redo k-bytes read
Wed Mar 14 14:32:11 2018
LGWR: STARTING ARCH PROCESSES
Wed Mar 14 14:32:11 2018
ARC0 started with pid=24, OS id=11928
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0: STARTING ARCH PROCESSES
Wed Mar 14 14:32:12 2018
ARC1 started with pid=25, OS id=11930
Thread 1 advanced to log sequence 141 (thread open)
Wed Mar 14 14:32:12 2018
ARC2 started with pid=26, OS id=11932
Thread 1 opened at log sequence 141
Current log# 3 seq# 141 mem# 0: /u02/oracle/oradata/orcl11g/redo03.log
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Wed Mar 14 14:32:12 2018
SMON: enabling cache recovery
Wed Mar 14 14:32:12 2018
ARC3 started with pid=27, OS id=11934
ARC1: Archival started
ARC2: Archival started
ARC3: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
ARC0: Becoming the 'no FAL' ARCH
ARC0: Becoming the 'no SRL' ARCH
ARC1: Becoming the heartbeat ARCH
Wed Mar 14 14:32:12 2018
NSA2 started with pid=28, OS id=11936
Archived Log entry 245 added for thread 1 sequence 140 ID 0x3fc66f1b dest 1:
ARC2: Standby redo logfile selected for thread 1 sequence 140 for destination LOG_ARCHIVE_DEST_2
ALTER SYSTEM SET log_archive_trace=0 SCOPE=BOTH SID='orcl11g';
ALTER SYSTEM SET log_archive_format='%t_%s_%r.dbf' SCOPE=SPFILE SID='orcl11g';
[11908] Successfully onlined Undo Tablespace 2.
Undo initialization finished serial:0 start:614426438 end:614428038 diff:1600 (16 seconds)
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
Database Characterset is ZHS16GBK
ARC1: Archive log rejected (thread 1 sequence 140) at host 'physical'
FAL[server, ARC1]: FAL archive failed, see trace file.
ARCH: FAL archive failed. Archiver continuing
ORACLE Instance orcl11g - Archival Error. Archiver continuing.
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Thread 1 advanced to log sequence 142 (LGWR switch)
Current log# 1 seq# 142 mem# 0: /u02/oracle/oradata/orcl11g/redo01.log
******************************************************************
LGWR: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2
******************************************************************
Archived Log entry 247 added for thread 1 sequence 141 ID 0x3fc66f1b dest 1:
Starting background process QMNC
Wed Mar 14 14:32:19 2018
QMNC started with pid=29, OS id=11947
ARC3: Standby redo logfile selected for thread 1 sequence 141 for destination LOG_ARCHIVE_DEST_2
Wed Mar 14 14:32:22 2018
Completed: ALTER DATABASE OPEN
Wed Mar 14 14:32:23 2018
Warning: Automated System Maintenance Tasks disabled.
Wed Mar 14 14:32:24 2018
db_recovery_file_dest_size of 4182 MB is 0.00% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Wed Mar 14 14:37:21 2018
Starting background process SMCO
Wed Mar 14 14:37:22 2018
SMCO started with pid=33, OS id=12005
Wed Mar 14 14:41:23 2018
Thread 1 advanced to log sequence 143 (LGWR switch)
Current log# 2 seq# 143 mem# 0: /u02/oracle/oradata/orcl11g/redo02.log
Wed Mar 14 14:41:25 2018
Archived Log entry 249 added for thread 1 sequence 142 ID 0x3fc66f1b dest 1:
Wed Mar 14 14:50:10 2018
Warning: VKTM detected a time drift.
Wed Mar 14 14:50:24 2018
Time drifts can result in an unexpected behavior such as time-outs. Please check trace file for more details.
Wed Mar 14 14:54:53 2018
WARN: ARC0: Terminating pid 11930 hung on an I/O operation
Wed Mar 14 14:58:32 2018
WARN: ARC3: Terminating pid 11930 hung on an I/O operation
Wed Mar 14 15:02:28 2018
WARN: ARC2: Terminating pid 11930 hung on an I/O operation
Wed Mar 14 15:02:28 2018
Killing 1 processes with pids 11930 (Process by index) in order to remove hung processes. Requested by OS process 11934
Wed Mar 14 15:05:59 2018
ARC3: Error 16198 due to hung I/O operation to LOG_ARCHIVE_DEST_2
Wed Mar 14 15:05:59 2018
ARC2: Error 16198 due to hung I/O operation to LOG_ARCHIVE_DEST_2
Wed Mar 14 15:05:56 2018
Killing 1 processes with pids 11930 (Process by index) in order to remove hung processes. Requested by OS process 11928
Wed Mar 14 15:06:25 2018
Process 0x0x7f4c6eb0 appears to be hung while dumping
Wed Mar 14 15:06:55 2018
Current time = 920632941, process death time = 920564582 interval = 60000
Wed Mar 14 15:07:39 2018
Attempting to kill process 0x0x7f4c6eb0 with OS pid = 12005
Wed Mar 14 15:08:17 2018
OSD kill succeeded for process 0x7f4c6eb0
Wed Mar 14 15:11:34 2018
ARC2: Detected ARCH process failure
Wed Mar 14 15:11:36 2018
Restarting dead background process SMCO
ARC2: STARTING ARCH PROCESSES
Wed Mar 14 15:12:12 2018
ARC3: Becoming the heartbeat ARCH
Wed Mar 14 15:12:35 2018
ARC1 started with pid=30, OS id=12166
Wed Mar 14 15:12:37 2018
ARC1: Archival started
ARC2: STARTING ARCH PROCESSES COMPLETE
Wed Mar 14 15:12:50 2018
Starting background process SMCO
Wed Mar 14 15:13:30 2018
SMCO started with pid=34, OS id=12182
Wed Mar 14 15:16:44 2018
Process RSM0, PID = 11926, will be killed
Wed Mar 14 15:18:33 2018
WARN: ARC0: Terminating pid 11934 hung on an I/O operation
Wed Mar 14 15:19:30 2018
Killing 1 processes with pids 11934 (Process by index) in order to remove hung processes. Requested by OS process 11928
Wed Mar 14 15:19:55 2018
ARC0: Detected ARCH process failure
ARC0: STARTING ARCH PROCESSES
Wed Mar 14 15:19:59 2018
RSM0 started with pid=23, OS id=12224
Wed Mar 14 15:20:15 2018
ARC3 started with pid=25, OS id=12238
Wed Mar 14 15:20:16 2018
ARC3: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
ARC3: Becoming the heartbeat ARCH
Wed Mar 14 15:21:42 2018
Process RSM0, PID = 12224, will be killed
Wed Mar 14 15:22:53 2018
RSM0 started with pid=23, OS id=12260
Wed Mar 14 15:25:54 2018
Errors in file /u02/oracle/diag/rdbms/primary/orcl11g/trace/orcl11g_mmon_11894.trc (incident=64454):
ORA-00445: background process "m001" did not start after 120 seconds
Incident details in: /u02/oracle/diag/rdbms/primary/orcl11g/incident/incdir_64454/orcl11g_mmon_11894_i64454.trc
Wed Mar 14 15:26:33 2018
WARN: ARC0: Terminating pid 12238 hung on an I/O operation
Wed Mar 14 15:27:16 2018
Killing 1 processes with pids 12238 (Process by index) in order to remove hung processes. Requested by OS process 11928
Wed Mar 14 15:27:46 2018
WARN: ARC2: Terminating pid 12238 hung on an I/O operation
Wed Mar 14 15:28:38 2018
WARN: ARC1: Terminating pid 12238 hung on an I/O operation
Wed Mar 14 15:28:38 2018
Killing 1 processes with pids 12238 (Process by index) in order to remove hung processes. Requested by OS process 11932
Wed Mar 14 15:29:13 2018
Dumping diagnostic data in directory=[cdmp_20180314152912], requested by (instance=1, osid=11894 (MMON)), summary=[incident=64454].
Wed Mar 14 15:29:34 2018
ARC1: Detected ARCH process failure
ARC1: STARTING ARCH PROCESSES
Wed Mar 14 15:30:38 2018
ARC3 started with pid=20, OS id=12328
Wed Mar 14 15:30:40 2018
ARC3: Archival started
ARC1: STARTING ARCH PROCESSES COMPLETE
Wed Mar 14 15:30:41 2018
ARC2: Becoming the heartbeat ARCH
Wed Mar 14 15:31:02 2018
Sweep [inc][64454]: completed
Sweep [inc2][64454]: completed
Wed Mar 14 15:32:37 2018
Thread 1 advanced to log sequence 144 (LGWR switch)
Current log# 3 seq# 144 mem# 0: /u02/oracle/oradata/orcl11g/redo03.log
Wed Mar 14 15:32:58 2018
Archived Log entry 251 added for thread 1 sequence 143 ID 0x3fc66f1b dest 1:
Wed Mar 14 15:33:29 2018
******************************************************************
LGWR: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2
******************************************************************
Wed Mar 14 16:01:57 2018
Process RSM0, PID = 12260, will be killed
Wed Mar 14 16:13:55 2018
Errors in file /u02/oracle/diag/rdbms/primary/orcl11g/trace/orcl11g_mmon_11894.trc (incident=64455):
ORA-00445: background process "m001" did not start after 120 seconds
Wed Mar 14 16:16:44 2018
Errors in file /u02/oracle/diag/rdbms/primary/orcl11g/trace/orcl11g_dmon_11902.trc (incident=64486):
ORA-00445: background process "RSM0" did not start after 120 seconds
Wed Mar 14 16:17:09 2018
Incident details in: /u02/oracle/diag/rdbms/primary/orcl11g/incident/incdir_64455/orcl11g_mmon_11894_i64455.trc
Wed Mar 14 16:17:58 2018
Incident details in: /u02/oracle/diag/rdbms/primary/orcl11g/incident/incdir_64486/orcl11g_dmon_11902_i64486.trc
Wed Mar 14 16:26:36 2018
Dumping diagnostic data in directory=[cdmp_20180314162635], requested by (instance=1, osid=11902 (DMON)), summary=[incident=64486].
Wed Mar 14 16:27:52 2018
Sweep [inc][64486]: completed
Sweep [inc][64455]: completed
Sweep [inc2][64486]: completed
Sweep [inc2][64455]: completed
备库上的日志alert.log
RFS[8]: Assigned to RFS process 11974
Wed Mar 14 15:05:40 2018
RFS[8]: Possible network disconnect with primary database
Wed Mar 14 15:09:51 2018
Process 0x0x7f4bd838 appears to be hung while dumping
Wed Mar 14 15:10:05 2018
Current time = 920661152, process death time = 920599871 interval = 60000
Wed Mar 14 15:10:23 2018
Attempting to kill process 0x0x7f4bd838 with OS pid = 11478
Wed Mar 14 15:10:48 2018
OSD kill succeeded for process 0x7f4bd838
Wed Mar 14 15:12:43 2018
Completed: Data Guard Broker cleanup
Restarting Data Guard Broker (DMON)
Wed Mar 14 15:13:43 2018
DMON started with pid=15, OS id=12175
Wed Mar 14 15:14:31 2018
Starting Data Guard Broker (DMON)
Wed Mar 14 15:16:17 2018
INSV started with pid=24, OS id=12189
Wed Mar 14 15:17:07 2018
***********************************************************************
Fatal NI connect error 12170.
VERSION INFORMATION:
TNS for Linux: Version 11.2.0.4.0 - Production
Oracle Bequeath NT Protocol Adapter for Linux: Version 11.2.0.4.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.4.0 - Production
Time: 14-MAR-2018 15:17:21
Tracing not turned on.
Tns error struct:
ns main err code: 12535
TNS-12535: TNS:operation timed out
ns secondary err code: 12606
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=172.17.225.197)(PORT=34787))
Wed Mar 14 15:17:23 2018
WARNING: inbound connection timed out (ORA-3136)
Wed Mar 14 15:19:41 2018
NSV0 started with pid=19, OS id=12209
Wed Mar 14 15:20:44 2018
***********************************************************************
Fatal NI connect error 12537, connecting to:
(LOCAL=NO)
VERSION INFORMATION:
TNS for Linux: Version 11.2.0.4.0 - Production
Oracle Bequeath NT Protocol Adapter for Linux: Version 11.2.0.4.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.4.0 - Production
Time: 14-MAR-2018 15:20:44
Tracing not turned on.
Tns error struct:
ns main err code: 12537
TNS-12537: TNS:connection closed
ns secondary err code: 12560
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
opiodr aborting process unknown ospid (12240) as a result of ORA-609
主库上监听状态
Services Summary...
Service "PRIMARY.localdomain" has 2 instance(s).
Instance "orcl11g", status UNKNOWN, has 1 handler(s) for this service...
Instance "orcl11g", status READY, has 1 handler(s) for this service...
Service "PRIMARY_DGB.localdomain" has 1 instance(s).
Instance "orcl11g", status READY, has 1 handler(s) for this service...
Service "PRIMARY_DGMGRL" has 1 instance(s).
Instance "orcl11g", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl11gXDB.localdomain" has 1 instance(s).
Instance "orcl11g", status READY, has 1 handler(s) for this service...
The command completed successfully
备库上监听状态
Services Summary...
Service "PHYSICAL.localdomain" has 2 instance(s).
Instance "sorcl11g", status UNKNOWN, has 1 handler(s) for this service...
Instance "sorcl11g", status READY, has 1 handler(s) for this service...
Service "PHYSICAL_DGB.localdomain" has 1 instance(s).
Instance "sorcl11g", status READY, has 1 handler(s) for this service...
Service "PHYSICAL_DGMGRL" has 1 instance(s).
Instance "sorcl11g", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
主库上的dgbroker的日志 dgorcl.log
>> Starting Data Guard Broker bootstrap <<
Broker Configuration File Locations:
dg_broker_config_file1 = "/u02/oracle/product/11.2.0/dbhome_1/dbs/dr1PRIMARY.dat"
dg_broker_config_file2 = "/u02/oracle/product/11.2.0/dbhome_1/dbs/dr2PRIMARY.dat"
03/14/2018 14:32:02
DMON Registering service PRIMARY_DGB with listener(s)
Broker Configuration: "dgc"
Protection Mode: Maximum Performance
Fast-Start Failover (FSFO): Disabled, flags=0x0, version=0
Primary Database: primary (0x01010000)
Standby Database: physical, Enabled Physical Standby (0x02010000)
03/14/2018 14:32:09
Version Check Results:
Database physical returned ORA-00000
Creating process RSM0
03/14/2018 14:33:51
Site physical returned ORA-16665.
......
Site physical returned ORA-16665.
03/14/2018 15:14:31
Site physical returned ORA-16665.
Site physical returned ORA-16665.
03/14/2018 15:14:43
Data Guard Broker Status Summary:
Type Name Severity Status
03/14/2018 15:14:44
Configuration dgc Warning ORA-16607
Primary Database primary Success ORA-00000
Physical Standby Database physical Error ORA-16665
03/14/2018 15:14:49
Site physical returned ORA-16665.
03/14/2018 15:15:57
Site physical returned ORA-16613.
03/14/2018 15:16:09
Redo transport problem detected: redo transport for database physical has the following error:
03/14/2018 15:16:36
Process RSM0, PID = 11926, will be killed
03/14/2018 15:17:49
Creating process RSM0
03/14/2018 15:20:07
Process RSM0 re-created with PID = 12224
03/14/2018 15:20:09
Error detected: one or more instances do not have log transport turned on.
当前系统配置
[oracle@iz2zehy7gff0kpg1swp1czz u02]$ top -c
top - 16:33:43 up 56 days, 21:49, 6 users, load average: 7.00, 11.11, 16.62
Tasks: 285 total, 1 running, 273 sleeping, 0 stopped, 11 zombie
%Cpu(s): 99.3 us, 0.7 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 1016168 total, 61372 free, 460000 used, 494796 buff/cache
KiB Swap: 204796 total, 170324 free, 34472 used. 65104 avail Mem
总是出现这个 应该看当时的VTTM日志
Warning: VKTM detected a time drift.
Tue Mar 20 16:34:44 2018
Time drifts can result in an unexpected behavior such as time-outs. Please check trace file for more details
问题4
DGMGRL> show configuration verbose;
Configuration - dgc
Protection Mode: MaxPerformance
Databases:
primary - Primary database
Error: ORA-16797: database is not using a server parameter file
physical - Physical standby database
Error: ORA-16525: the Data Guard broker is not yet available
在主库验证spfile是否使用,没有使用去启动,并重启数据库实例
SQL> show parameter spfile
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
spfile string
SQL> create spfile from pfile;
参考
http://blog.itpub.net/23718752/viewspace-1735714/
Tue Mar 06 11:16:10 2018
ARC2: Archive log rejected (thread 1 sequence 101) at host 'physical'
FAL[server, ARC2]: FAL archive failed, see trace file.
ARCH: FAL archive failed. Archiver continuing
ORACLE Instance orcl11g - Archival Error. Archiver continuing.
Service "PHYSICAL.localdomain" has 1 instance(s).
Instance "sorcl11g", status READY, has 1 handler(s) for this service...
Service "PRIMARY" has 1 instance(s).
Instance "orcl11g", status UNKNOWN, has 1 handler(s) for this service...
Service "PRIMARY_DGMGRL" has 1 instance(s).
Instance "orcl11g", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl11g.localdomain" has 1 instance(s).
Instance "orcl11g", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl11gXDB.localdomain" has 1 instance(s).
Instance "sorcl11g", status READY, has 1 handler(s) for this service...
Service "PHYSICAL" has 1 instance(s).
Instance "sorcl11g", status UNKNOWN, has 1 handler(s) for this service...
Service "PHYSICAL_DGMGRL" has 1 instance(s).
Instance "sorcl11g", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl11g.localdomain" has 1 instance(s).
Instance "sorcl11g", status UNKNOWN, has 1 handler(s) for this service...
60.100.87.121 8801/18801/28801
109.101.108.30 8801/18801/28801
10.40.70.194 3002/3003
166.79.59.42 1528
60.100.87.120 1521
203.244.224.85 1524/12521/13521
109.101.108.30 1521
71.52.3.51 1521
90.3.5.11 1521
90.3.5.11 1522
PI 的 潘代理