Linux下创建Oracle的实例
Linux下创建Oracle的实例 Trigl 2016-11-09 19:07:01 24167 收藏 9 分类专栏: Oracle 文章标签: oracle 实例 版权 Oracle 专栏收录该内容 4 篇文章0 订阅 订阅专栏 使用oracle用户登录,或su到oracle用户 1、首先设置要创建的ORACLE的SID export ORACLE_SID=addb 1 2、 创建相应目录 mkdir -p $ORACLE_BASE/admin/addb/{a,b,c,u}dump mkdir -p $ORACLE_BASE/admin/addb/pfile mkdir -p $ORACLE_BASE/oradata/addb 1 2 3 3、在$ORACLE_HOME/dbs目录下创建初始化文件 命名方法:init实例名.ora 本例中initaddb.ora cp init.ora initaddb.ora 即可以生成 vi initaddb.ora 进行编辑,将里面的内容对应修改一下,我的修改完如下: db_name='addb' memory_target=1G processes = 150 audit_file_dest='/data/install/oracle/admin/addb/adump' audit_trail ='db' db_block_size=8192 db_domain='' db_recovery_file_dest='/data/install/oracle/flash_recovery_area' db_recovery_file_dest_size=2G diagnostic_dest='/data/install/oracle' dispatchers='(PROTOCOL=TCP) (SERVICE=addbXDB)' open_cursors=300 remote_login_passwordfile='EXCLUSIVE' undo_tablespace='UNDOTBS1' # You may want to ensure that control files are created on separate physical # devices control_files = (ora_control3, ora_control4) compatible ='11.2.0' 注意不要用原来的<ORACLE_BASE>作为路径,修改为对应的绝对路径,否则会报错 而且注意control_files应该是新的文件,否则会报文件已存在的错误 4、创建密码文件 orapwd file=$ORACLE_HOME/dbs/orapwaddb password=addb123 entries=5 force=y 这里设置的是sys用户,密码是addb123 5、创建oracle的建库脚本 createdb.sql,内容如下,我将其放在了$ORACLE_BASE/oradata/addb下面 create database addb MAXINSTANCES 1 MAXLOGHISTORY 1 MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXDATAFILES 100 DATAFILE '/data/install/oracle/oradata/addb/system01.dbf' size 100m reuse autoextend on next 1m maxsize unlimited extent management local sysaux datafile '/data/install/oracle/oradata/addb/sysaux01.dbf' size 100m reuse autoextend on next 1m maxsize unlimited default temporary tablespace TEMP tempfile '/data/install/oracle/oradata/addb/temp01.dbf' size 20m reuse autoextend on next 640k maxsize unlimited undo tablespace UNDOTBS1 datafile '/data/install/oracle/oradata/addb/undo01.dbf' size 20m reuse autoextend on next 5M maxsize unlimited logfile GROUP 1 ('/data/install/oracle/oradata/addb/redo1.dbf') size 10m, GROUP 2 ('/data/install/oracle/oradata/addb/redo2.dbf') size 10m, GROUP 3 ('/data/install/oracle/oradata/addb/redo3.dbf') size 10m CHARACTER SET ZHS16GBK NATIONAL CHARACTER SET AL16UTF16 6、执行建库和数据字典脚本 以sysdba进入: sqlplus / as sysdba 1 执行下面命令: startup nomout; @$ORACLE_BASE/oradata/addb/createdb.sql @?/rdbms/admin/catalog.sql; @?/rdbms/admin/catproc.sql; @?/rdbms/admin/catexp.sql; 7、修改监听配置文件listener.ora 到$ORACLE_HOME/network/admin目录下:vi listener.ora addb = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522)) ) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 114.55.30.70)(PORT = 1522)) ) ) ) SID_LIST_addb = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = addb) (ORACLE_HOME = /data/install/oracle/product/11.2.0/db_1) (SID_NAME = addb) ) ) 8、启停 启停监听 lsnrctl start addb lsnrctl stop addb 1 2 启停实例 export ORACLE_SID=addb sqlplus / as sysdba >startup >shutdown ———————————————— 版权声明:本文为CSDN博主「Trigl」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/Trigl/article/details/53101888