Centos-6.7下 - Oracle 11gR2静默详细安装过程及排错 下载本文

内容发布更新时间 : 2024/5/20 21:52:49星期一 下面是文章的全部内容请认真阅读。

SQL>

使用show parameter;或者select table_name from dba_tables;看看是否正常

启动监听:lsnrctl start 查看监听:lsnrctl status 停止监听:lsnrctl stop

报错排除:

[oracle@oracledb database]$./runInstaller -silent -force -responseFile/opt/database/response/db_install.rsp Starting Oracle Universal Installer...

Checking Temp space: must begreater than 120 MB. Actual 161383 MB Passed Checking swap space: must be greater than 150 MB. Actual 16383MB Passed Preparing to launch Oracle Universal Installer from/tmp/OraInstall2015-01-26_01-34-45PM. Please wait ...[oracle@oracledbdatabase]$ [FATAL] [INS-32012] Unable to create directory. CAUSE: Either proper permissions were not granted to create thedirectory or there was no space left in the volume.

ACTION: Check your permission on the selected directory or choose anotherdirectory.

[FATAL] [INS-32012] Unable to create directory.

CAUSE: Either proper permissions were not granted to create thedirectory or there was no space left in the volume.

ACTION: Check your permission on the selected directory or chooseanother directory. error

[oracle@oracledb database]$./runInstaller -silent -force -responseFile/opt/database/response/db_install.rsp Starting Oracle Universal Installer...

Checking Temp space: must begreater than 120 MB. Actual 165989 MB Passed Checking swap space: must be greater than 150 MB. Actual 16383MB Passed Preparing to launch Oracle Universal Installer from/tmp/OraInstall2015-01-26_03-18-11PM. Please

wait ...[oracle@oracledbdatabase]$ [FATAL] [INS-32015] The location specified for Oracle home Locationis invalid.

CAUSE: The specified location cannot be used for Oracle homeLocation. Either

the specified location is not found on the system or isdetected to be a file. ACTION: Specify a valid location for Oracle home Location.

[WARNING] [INS-32018] The selected Oracle home is outside of Oracle base. CAUSE: The Oracle home selected was outside of Oracle base.

ACTION: Oracle recommends installing Oracle software within theOracle base directory. Adjust the Oracle home or Oracle base accordingly.

[FATAL] [INS-32021] Insufficient disk space on this volume for the selectedOracle home.

CAUSE: The selected Oracle home was on a volume without enoughdisk space. ACTION: Choose a location for Oracle home that has enough space(minimum of 4,397MB) or free up space on the existing volume. 解决办法:

检查了环境变量$ORACLE_BASE和$ORACLE_HOME发现两个路径均正常,没有发现任何异常

逐步从头排查,发现在文件./response/db_install.rsp中INVENTORY_LOCATION、ORACLE_BASE和ORACLE_HOME三个字段被配置成了相对路径 umask 022

export ORACLE_BASE=/home/oracle/app

export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1 export ORACLE_SID=ora11g

export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib export PATH=$ORACLE_HOME/bin :$PATH:$HOME/bin

[oracle@oracledb database]$./runInstaller -silent -force -responseFile/opt/database/response/db_install.rsp Starting Oracle Universal Installer...

Checking Temp space: must begreater than 120 MB. Actual 165989 MB Passed Checking swap space: must be greater than 150 MB. Actual 16383MB Passed Preparing to launch Oracle Universal Installer from/tmp/OraInstall2015-01-26_05-56-45PM. Please

wait ...[oracle@oracledbdatabase]$ [FATAL] [INS-32015] The location specified for Oracle home Locationis invalid.

CAUSE: The specified location cannot be used for Oracle homeLocation. Either the specified location is not found on the system or isdetected to be a file. ACTION: Specify a valid location for Oracle home Location.

[WARNING] [INS-32018] The selected Oracle home is outside of Oracle base. CAUSE: The Oracle home selected was outside of Oracle base.

ACTION: Oracle recommends installing Oracle software within theOracle base directory. Adjust the Oracle home or Oracle base accordingly.

[FATAL] [INS-32021] Insufficient disk space on this volume for the

selectedOraclehome.

CAUSE: The selected Oracle home was on a volume without enoughdisk space. ACTION: Choose a location for Oracle home that has enough space(minimum of 4,397MB) or free up space on the existing volume. A log of this session is currently saved

as:/tmp/OraInstall2015-01-26_05-56-45PM/installActions2015-01-26_05-56-45PM.log.Oracle recommends that if you want to keep this log, you should move it fromthe temporary location to a more permanent location.

解决方法

1.检查了环境变量$ORACLE_BASE和$ORACLE_HOME发现两个路径均正常,没有异常 2.查看./response/db_install.rsp文件

中INVENTORY_LOCATION、ORACLE_BASE和ORACLE_HOME三个字段被配置成了相对路径了,应该配置如下:

[oracle@oracledb ~]$ less /opt/database/response/db_install.rsp |grep-v \-v \

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0

oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=DB_m2 UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/opt/app/oracle/oraInventory SELECTED_LANGUAGES=en,zh_CN

ORACLE_HOME=/opt/app/oracle/product/11.2.0/db_1 ORACLE_BASE=/opt/app/oracle

$ sqlplus / as sysdba 报错如下:

[oracle@oracledb ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 16 14:21:24 2015 Copyright (c) 1982, 2009, Oracle. All rights reserved. ERROR:

ORA-12162: TNS:net service name is incorrectly specified Enter user-name:

*****解决办法

[oracle@oracledb ~]$ echo $ORACLE_HOME

/opt/app/oracle/product/11.2.0/db_1 [oracle@oracledb ~]$ echo $ORACLE_SID

oracle_SID 为空 添加SID

[oracle@oracledb ~]$ export ORACLE_SID=ora11g 确认添加成功

[oracle@oracledb ~]$ echo $ORACLE_SID ora11g

测试是否启动

[oracle@oracledb~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0Production on Mon Feb 16 14:26:57 2015 Copyright (c) 1982, 2009,Oracle. All rights reserved. Connected to an idle instance.

SQL> start

SP2-1506: START, @ or @@ command has no arguments SQL> startup

ORACLE instance started.

Total System Global Area3290345472 bytes

FixedSize 2217832 bytes Variable Size 1795164312 bytes Database Buffers 1476395008bytes

RedoBuffers 16568320 bytes Database mounted. Database opened. SQL>

正常,问题得到解决

还可以将ORACLE_SID等环境变量写入到系统profile中,但需要确保系统profile文件内容的有效

修改linux数据库字符集以及客户端相关问题:

如果linux能够利用sqlplus / as sysdba显示SQL>表示数据库已经安装成功,但是由于安装的时候使用的是 AL32UTF8需要改为ZHS16GBK

SQL> conn /as sysdba (sqlplus / assysdba)

SQL> shutdown immediate; (如果无反应 shutdown abort) SQL> startup mount

SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION; SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;

SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0; SQL> alter database open;

SQL> ALTER DATABASE CHARACTER SET AL32UTF8;

ORA-12712: new character set must be a superset of old character set 提示我们的字符集:新字符集必须为旧字符集的超集,这时我们可以跳过超集的检查做更改:

SQL> ALTER DATABASE character set INTERNAL_USE AL32UTF8;

--我们看到这个过程和之前ALTER DATABASE CHARACTER SET操作的内部过程是完全相同的,也就是说 INTERNAL_USE提供的帮助就是使Oracle数据库绕过了子集与超集的校验. SQL> shutdown immediate; SQL> startup

以后安装oracle的时候记得选择自定义安装,把这个字符集的事情事先弄好。

涉及三方面的字符集,

1. oracel server端的字符集; 2. oracle client端的字符集; 3. dmp文件的字符集。

在做数据导入的时候,需要这三个字符集都一致才能正确导入。

查询oracle server端的字符集

SQL> select userenv('language') from dual;

客户端添加环境变量NLS_LANG。 AMERICAN_AMERICA.ZHS16GBK 五、导入数据 六、配置监听

若PLSQL无法远程连接数据库,可修改监听文件, oracle账户下,修改监听文件

/opt/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora HOST=\ //第8行,HOST默认是主机名,改为本机的ip地址

然后增加以下内容: SID_LIST_LISTENER = (SID_LIST = (SID_DESC =

(SID_NAME = ora11g)

(ORACLE_HOME =/opt/app/oracle/product/11.2.0/dbhome_1) (PROGRAM = extproc)

)

(SID_DESC =

(GLOBAL_DBANAME = ora11g)

(ORACLE_HOME =/opt/app/oracle/product/11.2.0/dbhome_1) (SID_NAME = ora11g) ) )

oracle账户下,继续修改文件

/opt/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora HOST=\ // 第六行,同上将HOST主机名该为本机的IP地址 具体查看listener.ora和tnsnames.ora两个文件。