首先在ORACLE用戶下進入.bash_profile文件
[oracle@linux02 ~]$ vi .bash_profile
export ORACLE_SID=hldb
export ORACLE_UNQNAME=hldb
將ORACLE_SID和ORACLE_UNQNAME修改為新的數據庫名字
[oracle@linux02 ~]$ source .bash_profile
刷新文件
----------------------------------------------------------------------------------------------------------
進入/u01/app/oracle/oradata目錄下
[oracle@linux02 oradata]$ cd /u01/app/oracle/oradata
[oracle@linux02 oradata]$ pwd
/u01/app/oracle/oradata
新建一個文件夾
[oracle@linux02 oradata]$ mkdir hldb
進入$ORACLE_HOME/dbs
[oracle@linux02 ~]$ cd $ORACLE_HOME/dbs
創建密碼文件
[oracle@linux02 dbs]$ orapwd file=orapwhldb password=oracle
建立一個新的參數文件並寫入相關信息
[oracle@linux02 dbs]$ vi inithldb.ora
DB_NAME='hldb'
CONTROL_FILES='/u01/app/oracle/oradata/hldb/control01.ctl'
MEMORY_TARGET=900M
---------------------------------------------------------------------------
以SYS身份啟動sqlplus
[oracle@linux02 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Apr 23 10:03:27 2018
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
創建spfile文件
SQL> create spfile from pfile;
File created.
啟動實例,不加載數據庫
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 939495424 bytes
Fixed Size 2233960 bytes
Variable Size 545261976 bytes
Database Buffers 385875968 bytes
Redo Buffers 6123520 bytes
將以下參數復制進去
CREATE DATABASE hldb
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/hldb/redo01.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u01/app/oracle/oradata/hldb/redo02.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u01/app/oracle/oradata/hldb/redo03.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/hldb/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/u01/app/oracle/oradata/hldb/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/hldb/users01.dbf'
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/app/oracle/oradata/hldb/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/u01/app/oracle/oradata/hldb/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
-------------------------------------------------------------------------------------------------
數據庫文件逐一創建
SQL> CREATE DATABASE hldb
2 USER SYS IDENTIFIED BY oracle
3 USER SYSTEM IDENTIFIED BY oracle
4 LOGFILE GROUP 1 ('/u01/app/oracle/oradata/hldb/redo01.log') SIZE 100M BLOCKSIZE 512,
5 GROUP 2 ('/u01/app/oracle/oradata/hldb/redo02.log') SIZE 100M BLOCKSIZE 512,
6 GROUP 3 ('/u01/app/oracle/oradata/hldb/redo03.log') SIZE 100M BLOCKSIZE 512
7 MAXLOGFILES 5
8 MAXLOGMEMBERS 5
9 MAXLOGHISTORY 1
10 MAXDATAFILES 100
11 CHARACTER SET AL32UTF8
12 NATIONAL CHARACTER SET AL16UTF16
13 EXTENT MANAGEMENT LOCAL
14 DATAFILE '/u01/app/oracle/oradata/hldb/system01.dbf' SIZE 325M REUSE
15 SYSAUX DATAFILE '/u01/app/oracle/oradata/hldb/sysaux01.dbf' SIZE 325M REUSE
16 DEFAULT TABLESPACE users
17 DATAFILE '/u01/app/oracle/oradata/hldb/users01.dbf'
18 SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
19 DEFAULT TEMPORARY TABLESPACE tempts1
20 TEMPFILE '/u01/app/oracle/oradata/hldb/temp01.dbf'
21 SIZE 20M REUSE
22 UNDO TABLESPACE undotbs
23 DATAFILE '/u01/app/oracle/oradata/hldb/undotbs01.dbf'
24 SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
Database created.
-------------------------------------------------------------------------------------------------
In SQL*Plus, connect to your Oracle Database instance with the SYSDBA administrative privilege:
[oracle@linux02 ~]$ sqlplus / as sysdba
分別執行以下命令
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql
In SQL*Plus, connect to your Oracle Database instance as SYSTEM user:
[oracle@linux02 ~]$ sqlplus system/oracle
@?/sqlplus/admin/pupbld.sql
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
export ORACLE_SID=VDEDU 在本會話框里切成VDEDU這個數據庫
select instance_name from v$instance;查詢當前數據庫實例的名字
shutdown immediate;關閉數據庫
