oracle 11g 手动建库

由于命令部分加颜色会乱,所以有一些重点需要修改的地方我做的笔记并截图,放在文章最后。)

安装数据库软件并设置环境变量就不说了


创建密码文件

$ cd $ORACLE_HOME/dbs
$ orapwd file=orapwdPROD1 password=oracle

创建参数文件

$ cd $ORACLE_HOME/dbs
$ cat init.ora |grep -v ^# |grep -v ^$ >initPROD1.orp
$ vi initPROD1.orp

db_name='PROD1'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/PROD1/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=PROD1XDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = (/u01/app/oracle/oradata/PROD1/control01.ctl,/u01/app/oracle/fast_recovery_area/PROD1/control02.ctl)
compatible ='11.2.0'


创建目录
$ mkdir -p /u01/app/oracle/admin/PROD1/adump
$ mkdir -p /u01/app/oracle/oradata/PROD1
$ mkdir -p /u01/app/oracle/fast_recovery_area/PROD1/

设置edit调用vi(以下设置为永久生效)(临时可用ed _define=vim)

编辑glogin并添加一下行
$ vi $ORACLE_HOME/sqlplus/admin/glogin.sql
DEFINE _EDITOR = vi

启动数据库到nomount状态

$ export ORACLE_SID=PROD1
$ sqlplus / as sysdba
SQL> startup nomount
SQL> select * from dual;
清空然后添加一下内容并更改(创建建库脚本并执行)

SQL> ed

CREATE DATABASE PROD1
   USER SYS IDENTIFIED BY sys_password
   USER SYSTEM IDENTIFIED BY system_password
   LOGFILE GROUP 1 ('/u01/app/oracle/oradata/PROD1/redo01a.log') SIZE 100M BLOCKSIZE 512,
           GROUP 2 ('/u01/app/oracle/oradata/PROD1/redo02a.log') SIZE 100M BLOCKSIZE 512,
           GROUP 3 ('/u01/app/oracle/oradata/PROD1/redo03a.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/oracle/oradata/PROD1/system01.dbf' SIZE 325M REUSE
   SYSAUX DATAFILE '/u01/app/oracle/oradata/PROD1/sysaux01.dbf' SIZE 325M REUSE
   DEFAULT TABLESPACE users
      DATAFILE '/u01/app/oracle/oradata/PROD1/users01.dbf'
      SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
   DEFAULT TEMPORARY TABLESPACE tempts1
      TEMPFILE '/u01/app/oracle/oradata/PROD1/temp01.dbf'
      SIZE 20M REUSE
   UNDO TABLESPACE undotbs1
      DATAFILE '/u01/app/oracle/oradata/PROD1/undotbs01.dbf'
      SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED

/

执行

SQL> /

Database created.

创建数据字典

SQL> @?/rdbms/admin/catalog.sql

创建内部包

SQL> @?/rdbms/admin/catproc.sql

执行pupbld脚本

SQL> @?/sqlplus/admin/pupbld.sql


至此创建OK



oracle 11g 手动建库_第1张图片


创建建库脚本部分

oracle 11g 手动建库_第2张图片

你可能感兴趣的:(oracle学习笔记)