首页 > 代码库 > Oracle数据库初探
Oracle数据库初探
一、安装oracle数据库
步骤:转载一个很不错的文档:http://www.linuxidc.com/Linux/2015-02/113222.htm
注意点:安装的时候会check相关依赖,有些可能提示找不到,莫慌,rpm qa | grep 包名,如果已经存在,安装界面右上角ignore all即可,否则要卸载原来的依赖包版本,依赖套依赖,到时候指不定有啥麻烦。
注意点:指定字符集,不然后期需要更改还是比较麻烦的。这个需要设置环境变量,
export LANG=en_US.gbk
export NLS_LANG=american_america.ZHS16GBK
如果是SIMPLIFIED CHINESE_CHINA.ZHS16GBK,需要加上引号,因为环境变量不能有空格。export NLS_LANG="SIMPLIFIED CHINESE_CHINA".ZHS16GBK
注意点:要记得指定的实例名,一般是orcl
二、使用中的问题
如果安装的时候没有指定字符集或者需要的字符集不匹配,后期想改咋办?
按照下面的步骤走一波:
oracle数据库的字符集更改 A、oracle server 端 字符集查询 select userenv(‘language‘) from dual 其中NLS_CHARACTERSET 为server端字符集 NLS_LANGUAGE 为 server端字符显示形式 B、查询oracle client端的字符集 $echo $NLS_LANG 如果发现你select 出来的数据是乱码,请把client端的字符集配置成与linux操作系统相同的字符集。如果还是有乱码,则有可能是数据库中的数据存在问题,或者是oracle服务端的配置存在问题。 C、server端字符集修改 ***************************************************************** * 更改字符集步骤方法(WE8ISO8859P1 --> ZHS16GBK) * ***************************************************************** SQL> 将数据库启动到RESTRICTED模式下做字符集更改: SQL> conn /as sysdba Connected. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 236000356 bytes Fixed Size 451684 bytes Variable Size 201326592 bytes Database Buffers 33554432 bytes Redo Buffers 667648 bytes Database mounted. SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION; System altered. SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0; System altered. SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0; System altered. SQL> alter database open; Database altered. 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; Database altered. SQL> select * from v$nls_parameters; 略 19 rows selected. 重启检查是否更改完成: SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 236000356 bytes Fixed Size 451684 bytes Variable Size 201326592 bytes Database Buffers 33554432 bytes Redo Buffers 667648 bytes Database mounted. Database opened. SQL> select * from v$nls_parameters; 略 19 rows selected. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
怎么打开数据库,监听器?
1. linux下启动oracle su - oracle sqlplus /nolog conn /as sysdba startup exit lsnrctl start exit 2. linux下关闭oracle su - oracle sqlplus /nolog conn /as sysdba shutdown immediate exit lsnrctl stop exit 3、启动监听器 oracle@suse92:~> lsnrctl start 4、停止监听器 oracle@suse92:~> lsnrctl stop 5、查看监听器状态 oracle@suse92:~> lsnrctl LSNRCTL> status LSNRCTL> exit
怎样设置Oracle数据库最大链接?
找到 $ORACLE_HOME/network/admin/listener.ora,加上下面的
SID_LIST_LISTENER= (SID_LIST= (SID_DESC= #BEQUEATH CONFIG (GLOBAL_DBNAME=orcl) (SID_NAME=orcl) (ORACLE_HOME=/u01/oracle) #PRESPAWN CONFIG (PRESPAWN_MAX=20) (PRESPAWN_LIST= (PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1)) ) ) )
设置还原点,闪回点,有现成的,我就不多费口舌了,有问题随时baidu.com
还原点简单的使用:http://blog.csdn.net/u012702547/article/details/46679095
闪回还原点:http://blog.itpub.net/29800581/viewspace-1314515/
Oracle数据库初探