ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 11g OCM---create the databse

11g OCM---create the databse

原创 Linux操作系统 作者:DBA_oracle_java 时间:2013-08-19 21:49:52 0 删除 编辑
11g OCM---create the databse
1.Specify an Instance Identifier (SID)
 oracle@szsckj:/home/oracle>env | grep ORACLE_SID
 ORACLE_SID=ocm
2.Ensure That the Required Environment Variables Are Set
#env | grep ORA
ORACLE_SID=ocm
ORACLE_BASE=/u02/app/oracle
ORACLE_HOME=/u02/app/oracle/products/11.2.0
PATH=$PATH:$ORACLE_HOME/bin
3.Choose a Database Administrator Authentication Method
#cd $ORACLE_HOME/dbs
#orapwd file=orapwocm password=oracle entries=5
4.Create the Initialization Parameter File
#cd $ORACLE_HOME/dbs
#vi initocm.ora

db_name='ocm'
###support memory_target=1g,IN OS # mount -t tmpfs shmfs -o size=2g /dev/shm
memory_target=1G
processes = 150
audit_file_dest='$ORACLE_BASE/admin/ocm/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 = (/ORADATA/ocm/control01.ctl, /ORADATA/ocm/control02.ctl)
compatible ='11.2.0'

###create directory ON OS
mkdir -p $ORACLE_BASE/admin/ocm/adump
mkdir -p $ORACLE_BASE/flash_recovery_area
mkdir -p /ORADATA/ocm/

5.(Windows Only) Create an Instance

6.Connect to the Instance
#sqlplus  / as sysdba

7.Create a Server Parameter File
SQL> create spfile from pfile;

8.Start the Instance 
SQL> STARTUP NOMOUNT;
9.Issue the CREATE DATABASE Statement
#cat /home/oracle/scripts/createDB.sql
CREATE DATABASE ocm
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/ORADATA/ocm/redo01a.log','/ORADATA/ocm/redo01b.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/ORADATA/ocm/redo02a.log','/ORADATA/ocm/redo02b.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/ORADATA/ocm/redo03a.log','/ORADATA/ocm/redo03b.log') SIZE 100M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/ORADATA/ocm/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/ORADATA/ocm/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE '/ORADATA/ocm/users01.dbf'
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/ORADATA/ocm/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE UNDOTBS1
DATAFILE '/ORADATA/ocm/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

SQL> @/home/oracle/scripts/createDB.sql

10.Create Additional Tablespaces
SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
ocm              OPEN

CREATE TABLESPACE apps_tbs LOGGING 
 DATAFILE '/ORADATA/ocm/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 '/ORADATA/ocm/indx01.dbf' 
 SIZE 100M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED 
 EXTENT MANAGEMENT LOCAL;

11.Run Scripts to Build Data Dictionary Views
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/sqlplus/admin/pupbld.sql
EXIT

12.(Optional) Run Scripts to Install Additional Options

13.Back Up the Database
SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     5
Current log sequence           7

SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database archivelog;

SQL> archive log list; 
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     5
Next log sequence to archive   7
Current log sequence           7

SQL> !rman target /
RMAN> backup database format '/RECO/rman/%d_%T_%s_%p.bak' plus archivelog format '/RECO/rman/arch_%d_%T_%s_%p.bak';


14. (Optional) Enable Automatic Instance Startup

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26169542/viewspace-768829/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-07-02

  • 博文量
    31
  • 访问量
    117128