问题:
一.[oracle@localhost ~]$ sqlplus / as sysdba
sqlplus: error while loading shared libraries: /u01/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1: cannot restore segment prot after reloc: Permission denied
Linux下共享库问题导致无法启动SQLPLUS的问题解决,这个问题是由于SELINUX引起的,
解决办法如下:
1. [oracle@localhost ~]$ls –l /u01/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1
-rwxrwxrwx 1 oracle oinstall 40028297 Jun 8 21:07 /u01/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1
2.编辑/etc/sysconfig/selinux配置文件, 把SELINUX=enforcing 改为 SELINUX=disabled
3.使用命令chcon改变文件或者目录的SELinux属性, 语法chcon -t texrel_shlib_t 库名字
[oracle@localhost~]$ chcon -t texrel_shlib_t /u01/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1
二.解决dbca创建数据库时的错误
[oracle@localhost ~]$dbca
Oracle Net Services Configuration:
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# SIGSEGV (0xb) at pc=0xa44b13a8, pid=2973, tid=3086891216
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_17-b02 mixed mode)
# Problematic frame:
# C [libnnz11.so+0x3c3a8]
#
# An error report file with more information is saved as hs_err_pid2973.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
解决方案:安装补丁
1.确认是否配置了ORACLE_HOME
[oracle@localhost~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1
2.检查perl的版本,需要5.00503以上的版本
[oracle@localhost~]$ perl -v
This is perl, v5.8.8 built for i386-linux-thread-multi
3.关闭数据库,执行以下命令
[oracle@localhost~]$cd /…/8670579
[oracle@8670579 ~]$$ORACLE_HOME/OPatch/opatch apply
三.解决安装oracle11gr2时提示pdksh conflicts with ksh-20100621-2.el6.i686问题
解决方法:
#rpm -e ksh-20100621-2.el6.i686
#rpm -ivh pdksh-5.2.14-36.el5.i386.rpm
四.修改Oracle字符集
1.oracle server 端字符集查询
select userenv('language') from dual;
server 字符集修改:
将数据库启动到RESTRICTED模式下做字符集更改:
SQL>conn /as sysdba
SQL>shutdown immediate;
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 ZHS16GBK;
ALTER DATABASE CHARACTER SET ZHS16GBK ERROR at line 1:
ORA-12712: new character set must be a superset of old character set
提示我们的字符集:新字符集必须为旧字符集的超集,这时我们可以跳过超集的检查做更改:
SQL>ALTER DATABASE character set INTERNAL_USE ZHS16GBK;
SQL>select * from v$nls_parameters;
重启检查是否更改完成:
SQL>shutdown immediate;
SQL>startup
SQL>select * from v$nls_parameters;
我们看到这个过程和之前ALTER DATABASE CHARACTER SET操作的内部过程是完全相同的,也就是说INTERNAL_USE提供的帮助就是使Oracle数据库绕过了子集与超集的校验
这一方法在某些方面是有用处的,比如测试;应用于产品环境时大家应该小心,可能会有一些意外的问题。
2.oracle client端字符集修改
$echo$NLS_LANG
client字符集修改:
在 /home/oracle与 /root用户目录下的.bash_profile中添加或修改 export NLS_LANG="AMERICAN_AMERICA.UTF8" 语句
关闭当前ssh窗口。
注意:NLS_LANG变量一定要配置正确否则会引起sqlplus失效。
3.修改数据库字符集为UTF-8
1.以DBA登录
2.执行转换语句:
SHUTDOWN IMMEDIATE;
STARTUP MOUNT EXCLUSIVE;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;
ALTER DATABASE NATIONAL CHARACTER SET UTF8;
SHUTDOWN IMMEDIATE;
STARTUP;
注意:如果没有大对象,在使用过程中进行语言转换没有什么影响!
可能会出现ORA-12717:CANNOT ALTER DATABASE NATIONAL CHARACTER SET WHEN NCLOBDATAEXISTS
解决这个问题的方法
利用INTERNAL_USE 关键字修改区域设置
ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE UTF8;
五.Enterprise Manager 无法连接到数据库实例。下面列出了组件的状态---完整解决方案
sysman用户打开
select username,account_status from dba_users where username='SYSMAN'
通过emca重建资料库解决
1.先删除原来的配置
SQL>drop user sysman cascade
SQL>drop role MGMT_USER
SQL>drop user MGMT_VIEW cascade
SQL>drop public synonym MGMT_TARGET_BLACKOUTS
SQL>drop public synonym SETEMVIEWUSERCONTEXT
2.创建新的配置
$emca -repos recreate
$emca -config dbcontrol db (重新配置emctl)
六.解决Linux下sqlplus上下光标键乱码问题
1.安装 readline
2.安装 rlwrap
#tar -zxvf rlwrap-0.37.tar.gz(安装包放在用户主目录下)
# cd rlwrap-0.37
# ./configure
# make
# makeinstall
# man rlwrap
3.修改用户根目录下的.bashrc(或修改.bash_profile或者.profile文件)
alias sqlplus='rlwrap sqlplus' //添加这一行
alias rman='rlwrap rman'
七.解决Oracle:ORA:16033错误
cmd>sqlplus / as sysdba
sql>create pfile='C:\pfile.txt' from spfile;
修改pfile.txt文件中的内容。(若文件拒绝访问可复制一份进行修改)
sql>create spfile from pfile='C:\pfile.txt'; --创建新的 spfile 文件
sql>startup