在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
手动创建PROD数据库 步骤1 指定SID
ORACLE_SID=prod export ORACLE_SID 步骤2 确定Oracle环境的环境变量在操作系统平台下, 创建数据目录和审计目录: [oracle@db1 oradata]$ mkdir -p /u01/app/oradata/prod [oracle@db1 oradata]$ mkdir -p $ORACLE_BASE/admin/prod/adump [oracle@db1 dbs]$ mkdir -p /u01/app/flash_recovery_area 环境变量配置: ORACLE_BASE=/u01/app ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 #ORACLE_SID=oradb ORACLE_SID=prod export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH=$ORACLE_HOME/bin:$PATH export PATH alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman' 即时生效,验证 [oracle@db1 ~]$ source .bash_profile [oracle@db1 ~]$ echo $ORACLE_SID prod 可选操作,部署glogin.sql和rlwrap $ORACLE_HOME/sqlplus/admin/glogin.sql set sqlprompt _user'@'_connect_identifier> rlwarp的配置,参考:rlwarp的使用 步骤3 设置Oracle的口令认证方式创建Oracle的口令文件 [oracle@db1 ~]$ cd $ORACLE_HOME/dbs [oracle@db1 dbs]$ orapwd file=orapwPROD password=oracle entries=30 步骤4 创建初始化参数文件官方文档的参考文件链接为:Oracle参数文件的例子 cd $ORACLE_HOME/dbs 官方的参数文件 db_name='ORCL' memory_target=1G processes = 150 audit_file_dest='<ORACLE_BASE>/admin/orcl/adump' audit_trail ='db' db_block_size=8192 db_domain='' db_recovery_file_dest='<ORACLE_BASE>/flash_recovery_area' db_recovery_file_dest_size=2G diagnostic_dest='<ORACLE_BASE>' dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)' 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_control1, ora_control2) compatible ='11.2.0' 通过vi命令中的
修改后,我个人的参数文件 db_name='prod' memory_target=1G processes = 150 audit_file_dest='/u01/app/admin/prod/adump' audit_trail ='db' db_block_size=8192 db_domain='' db_recovery_file_dest='/u01/app/flash_recovery_area' db_recovery_file_dest_size=2G diagnostic_dest='/u01/app' dispatchers='(PROTOCOL=TCP) (SERVICE=prodXDB)' 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 = (/u01/app/oradata/prod/control01.ctl, /u01/app/oradata/prod/control02.ctl) compatible ='11.2.0' 步骤5 连接数据库实例有命令文件,可以通过如下命令连接: [oracle@db1 dbs]$ sqlplus /nolog @> connect sys as sysdba Enter password: Connected to an idle instance. SYS@prod> OS认证登录方式,命令如下: [oracle@db1 dbs]$ sqlplus /nolog @> conn /as sysdba Connected to an idle instance. SYS@prod> 步骤6 创建spfile文件SYS@prod> CREATE SPFILE FROM PFILE; 步骤7 启动实例STARTUP NOMOUNT 步骤8 使用CREATE DATABASE语句建库官方给与建库的例句,你可以修改你自己所需的数据库的样子,如下: CREATE DATABASE prod USER SYS IDENTIFIED BY oracle USER SYSTEM IDENTIFIED BY oracle LOGFILE GROUP 1 ('/u01/app/oradata/prod/redo01a.log','/u01/app/oradata/prod/redo01b.log') SIZE 100M BLOCKSIZE 512, GROUP 2 ('/u01/app/oradata/prod/redo02a.log','/u01/app/oradata/prod/redo02b.log') SIZE 100M BLOCKSIZE 512, GROUP 3 ('/u01/app/oradata/prod/redo03a.log','/u01/app/oradata/prod/redo03b.log') SIZE 100M BLOCKSIZE 512 MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 CHARACTER SET AL32UTF8 NATIONAL CHARACTER SET AL16UTF16 EXTENT MANAGEMENT LOCAL DATAFILE '/u01/app/oradata/prod/system01.dbf' SIZE 325M REUSE SYSAUX DATAFILE '/u01/app/oradata/prod/sysaux01.dbf' SIZE 325M REUSE DEFAULT TABLESPACE users DATAFILE '/u01/app/oradata/prod/users01.dbf' SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE '/u01/app/oradata/prod/temp01.dbf' SIZE 20M REUSE UNDO TABLESPACE undotbs1 DATAFILE '/u01/app/oradata/prod/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; 执行语句如下: [oracle@db1 ~]$ chmod 755 create_database.sql [oracle@db1 ~]$ sqlplus "/as sysdba" SYS@prod> @create_database.sql Database created. 步骤9 创建额外的空间对于应用程序来说,应该有属于自己的表空间,对于我们这边的都是以ARP命名,如下: CREATE TABLESPACE apps_arp LOGGING DATAFILE '/u01/app/oradata/prod/apps_arp01.dbf' SIZE 500M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL; -- create a tablespace for indexes, separate from user tablespace (optional) CREATE TABLESPACE indx_arp LOGGING DATAFILE '/u01/app/oradata/prod/indx_arp01.dbf' SIZE 100M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL; 步骤10 执行脚本构建数据字典视图使用 [oracle@db1 ~]$ sqlplus /nolog @> conn /as sysdba Connected. SYS@prod> 执行如下语句: @?/rdbms/admin/catalog.sql @?/rdbms/admin/catproc.sql @?/rdbms/admin/utlrp.sql 使用 [oracle@db1 ~]$ sqlplus /nolog @> conn system/oracle Connected. SYSTEM@prod> @?/sqlplus/admin/pupbld.sql 【可选操作】,如果需要scott用户用于数据库的实验,可以做如下操作: [oracle@db1 ~]$ sqlplus /nolog @> conn / as sysdba Connected. SYS@prod> @?/rdbms/admin/utlsampl.sql 验证数据库,是否正常,如下: [oracle@db1 ~]$ sqlplus "/as sysdba" SYS@prod> select INSTANCE_NAME,STATUS from v$instance; INSTANCE_NAME STATUS ---------------- ------------ prod OPEN 参考文献官方文档: 位置为:【Oracle Database Administrator's Guide】 -->【Creating a Database with the CREATE DATABASE Statement】 到此这篇关于Oracle手动建库安装部署超详细教程的文章就介绍到这了,更多相关Oracle手动建库内容请搜索极客世界以前的文章或继续浏览下面的相关文章希望大家以后多多支持极客世界! |
请发表评论