Create database Oracle experiment three - hand

Recommended for you: Get network issues from WhatsUp Gold. Not end users.
The official document reference: http://docs.oracle.com/cd/E11882_01/server.112/e25494/create.htm#ADMIN11073

This section is mainly suitable for the single instance installation. (single instance does not refer to an instance, can only be installed on the server but can be multiple instances (and their databases) running on the server, but only one database access is only allowed to access an instance. )

The experimental environment, continue to operate:
In this section, the main steps, the name of the database to ocp1 as an example:
1 specifies the instance identifier(SID)
[root@ocp ~]# su - oracle
[oracle@ocp ~]$ export ORACLE_SID=ocp1
[oracle@ocp ~]$ echo $ORACLE_SID
ocp1

Creates a new instance of the corresponding directory 2
Create a $ORACLE_SID directory under the $ORACLE_BASE/admin, create a /adump sub directory and the directory (storage audit file directory), /bdump (background processes trace files), /cdump (memory core stacking file), /udump (storage of user process trace file)
[oracle@ocp ~]$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/{a,b,c,u}dump
[oracle@ocp ~]$ ls $ORACLE_BASE/admin
ocp  ocp1
[oracle@ocp ~]$ ls $ORACLE_BASE/admin/$ORACLE_SID
adump  bdump  cdump  udump
Create a new instance of the database directory
[oracle@ocp ~]$ mkdir -p $ORACLE_BASE/oradata/$ORACLE_SID
[oracle@ocp ~]$ ls $ORACLE_BASE/oradata
ocp  ocp1

3 create the initialization parameter file
The initialization parameter file official sample: http://docs.oracle.com/cd/E11882_01/server.112/e25494/create.htm#ADMIN12543
[oracle@ocp ~]$ cd $ORACLE_HOME/dbs
[oracle@ocp dbs]$ cat init.ora | grep -v ^$ | grep -v ^# >init$ORACLE_SID.ora
[oracle@ocp dbs]$ ls *.ora
initocp1.ora  init.ora  spfileocp.ora
[oracle@ocp dbs]$ vim initocp1.ora
(1)Delete the xxxxpool_size like xxxxbuffer
(2)Modify the db_name values for $ORACLE_SID: db_name=ocp1
(3)Add the following content
sga_max_size=300m
sga_target=300m
undo_tablespace=undotbs
undo_management=auto
#The undo_tablespace this parameter modification
(4)To modify the control files parameter, as follows:
control_files = ('/u01/app/oracle/oradata/ocp1/control01.ctl',
                 '/u01/app/oracle/oradata/ocp1/control02.ctl'
                 '/u01/app/oracle/oradata/ocp1/control03.ctl')
(5)Modify the other parameters
audit_file_dest='<ORACLE_BASE>/admin/orcl/adump'
Modified audit_file_dest='/u01/app/oracle/admin/ocp1/adump'
db_recovery_file_dest='<ORACLE_BASE>/flash_recovery_area'
Modified db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
diagnostic_dest='<ORACLE_BASE>'
Modified diagnostic_dest='/u01/app/oracle'

4 to create the password file (Oracle database password has two kinds of management modes, one is the password file, a system user specific information, check the official document)
[oracle@ocp dbs]$ orapwd file=orapw$ORACLE_SID password=oracle            #The password is Oracle

5 start the instance (NOMOUNT state)
[oracle@ocp dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 15 09:41:51 2013
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area  313159680 bytes
Fixed Size    2212936 bytes
Variable Size  104860600 bytes
Database Buffers  201326592 bytes
Redo Buffers    4759552 bytes

6 running a database script
The official script database example mynewdb
CREATE DATABASE mynewdb
   USER SYS IDENTIFIED BY sys_password
 
   USER SYSTEM IDENTIFIED BY system_password
 
   LOGFILE GROUP 1 ('/u01/logs/my/redo01a.log','/u02/logs/my/redo01b.log') SIZE 100M BLOCKSIZE 512,
           GROUP 2 ('/u01/logs/my/redo02a.log','/u02/logs/my/redo02b.log') SIZE 100M BLOCKSIZE 512,
           GROUP 3 ('/u01/logs/my/redo03a.log','/u02/logs/my/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/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 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
   DEFAULT TEMPORARY TABLESPACE tempts1
      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;
Formal operation, modify the sample script and save/tmp/ocp1.sql
SQL> hos vim /tmp/ocp1.sql
:%s/mynewdb/ocp1/gc
a
   LOGFILE GROUP 1 ('/u01/logs/my/redo01a.log','/u02/logs/my/redo01b.log') SIZE 100M BLOCKSIZE 512,
           GROUP 2 ('/u01/logs/my/redo02a.log','/u02/logs/my/redo02b.log') SIZE 100M BLOCKSIZE 512,
           GROUP 3 ('/u01/logs/my/redo03a.log','/u02/logs/my/redo03b.log') SIZE 100M BLOCKSIZE 512
Change into
   LOGFILE GROUP 1 ('/u01/app/oracle/oradata/ocp1/redo01.log') SIZE 100M BLOCKSIZE 512,
           GROUP 2 ('/u01/app/oracle/oradata/ocp1/redo02.log') SIZE 100M BLOCKSIZE 512,
           GROUP 3 ('/u01/app/oracle/oradata/ocp1/redo03.log') SIZE 100M BLOCKSIZE 512
Modify the sys_password manager # revise your own password
Modify the system_password manager # revise your own password
wq
SQL> @/tmp/ocp1.sql
Database created.

7 create additional table space (optional)
Sample script in official documents
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;

SQL> host vim /tmp/addp.sql
The sample scripts, copied, modified the instance data name
%s/mynewdb/ocp1/gc
a
wq
SQL> @/tmp/addp.sql

Tablespace created.
Tablespace created.

8 operation data dictionary script
Run the data dictionary view
SQL> @?/rdbms/admin/catalog.sql
Running the PL/SQL software package and process
SQL> @?/rdbms/admin/catproc.sql




From the known notes(Wiz)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Dolores at December 02, 2013 - 3:43 PM