当前位置:操作系统 > Unix/Linux >>

11g R2单实例手工建库

11g R2单实例手工建库
 
以下是官档里面的步骤,我只是重新做了一遍,练练手。我的操作系统RedHat 6.4 x64+11.2.0.4的数据库软件
Step 1: Specify an Instance Identifier (SID)
export ORACLE_SID=mynewdb


Step 2: Ensure That the Required Environment Variables Are Set
[oracle@rh64 ~]$ echo $ORACLE_SID
mynewdb
Step 3: Choose a Database Administrator Authentication Method
[oracle@rh64 ~]$ orapwd file=orapwmynewdb entries=30


Enter password for SYS:oracle
Step 4: Create the Initialization Parameter File
Oracle强烈建议加入以下参数三个参数,其中DB_NAME是强制必须的,另外的两个非强制。
DB_NAME
CONTROL_FILES
MEMORY_TARGET
initmynewdb.ora
DB_NAME=mynewdb
CONTROL_FILES = (/u01/app/oracle/oradata/mynewdb/control01.ctl,/u01/app/oracle/oradata/mynewdb/control02.ctl,/u01/app/oracle/oradata/mynewdb/control03.ctl)
Step 5: (Windows Only) Create an Instance
此步略过
Step 6: Connect to the Instance
sqlplus / as sysdba
Step 7: Create a Server Parameter File
create spfile from pfile;
Step 8: Start the Instance
STARTUP NOMOUNT
Step 9: Issue the CREATE DATABASE Statement(相应目录名字要提前建好)
CREATE DATABASE mynewdb
   USER SYS IDENTIFIED BY oracle
   USER SYSTEM IDENTIFIED BY oracle
   LOGFILE GROUP 1 ('/u01/app/oracle/oradata/mynewdb/redo01a.log','/u01/app/oracle/oradata/mynewdb/redo01b.log') SIZE 50M ,
           GROUP 2 ('/u01/app/oracle/oradata/mynewdb/redo02a.log','/u01/app/oracle/oradata/mynewdb/redo02b.log') SIZE 50M ,
           GROUP 3 ('/u01/app/oracle/oradata/mynewdb/redo03a.log','/u01/app/oracle/oradata/mynewdb/redo03b.log') SIZE 50M 
   MAXLOGFILES 5
   MAXLOGMEMBERS 5
   MAXLOGHISTORY 5
   MAXDATAFILES 1000
   CHARACTER SET ZHS16GBK
   NATIONAL CHARACTER SET AL16UTF16
   EXTENT MANAGEMENT LOCAL
   DATAFILE '/u01/app/oracle/oradata/mynewdb/system01.dbf' SIZE 325M REUSE
   SYSAUX DATAFILE '/u01/app/oracle/oradata/mynewdb/sysaux01.dbf' SIZE 325M REUSE
   DEFAULT TABLESPACE users
      DATAFILE '/u01/app/oracle/oradata/mynewdb/users01.dbf'
      SIZE 10M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
   DEFAULT TEMPORARY TABLESPACE temp
      TEMPFILE '/u01/app/oracle/oradata/mynewdb/temp01.dbf'
      SIZE 20M REUSE
   UNDO TABLESPACE undotbs
      DATAFILE '/u01/app/oracle/oradata/mynewdb/undotbs01.dbf'
      SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

Step 10: Create Additional Tablespaces
CREATE TABLESPACE apps_tbs LOGGING 
     DATAFILE '/u01/app/oracle/oradata/mynewdb/apps01.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_tbs LOGGING 
     DATAFILE '/u01/app/oracle/oradata/mynewdb/indx01.dbf' 
     SIZE 100M REUSE AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED 
     EXTENT MANAGEMENT LOCAL;
Step 11: Run Scripts to Build Data Dictionary Views
In SQL*Plus, connect to your Oracle Database instance with the SYSDBA administrative privilege:
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql

In SQL*Plus, connect to your Oracle Database instance as SYSTEM user:
@?/sqlplus/admin/pupbld.sql  
Step 12: (Optional) Run Scripts to Install Additional Options

Step 13: Back Up the Database.
Step 14: (Optional) Enable Automatic Instance Startup

 


CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,