1. 程式人生 > >Oracle 11g 手工建立資料庫實驗

Oracle 11g 手工建立資料庫實驗

Oracle資料庫的手工建庫是依據Oracle資料庫的體系結構,依次建立例項、建立物理結構、建立邏輯結構。


手工建庫一般需要八個步驟:
1.設定oracle使用者環境變數
2.準備資料庫相關目錄
3.生成例項的口令檔案
4.生成例項的pfile引數檔案
5.生成例項的spfile檔案,並啟動到nomount
6.執行資料庫建立語句
7.執行動態效能檢視建立指令碼
8.確認資料庫執行狀態


具體操作過程如下:

1.設定oracle使用者環境變數
$ cd
$ vim .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=ENMOEDU
export PATH=$ORACLE_HOME/bin:$PATH
生效:
source .bash_profile
驗證:
echo $ORACLE_HOME
echo $ORACLE_SID

2.建立所需的目錄
建立目錄:
$ cd $ORACLE_BASE
$ mkdir -p admin/ENMOEDU/adump
$ mkdir -p oradata/ENMOEDU

注意:這裡的目錄路徑,與後面pfile檔案中的路徑一定要對應,否則後面會報錯,比如:
ORA-09925: Unable to create audit trail file


3.生產密碼檔案
$ cd $ORACLE_HOME/dbs
$ orapwd file=orapwENMOEDU password=oracle entries=30

4.生成例項的pfile引數檔案
根據已經由的init.ora內容生成待調整的pfile引數檔案
$ df -h
$ cd $ORACLE_HOME/dbs
$ cat init.ora | grep -v ^# | grep -v ^$ > initENMOEDU.ora
將註釋和空行去掉,得到引數檔案


需要修改的六個引數為: 
$ vim initENMOEDU.ora
db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='<ORACLE_BASE>/admin/orcl/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'
control_files = (ora_control1, ora_control2)
compatible ='11.2.0'

多次出現的<ORACLE_BASE> 可以用下面的命令替代:
:%s+<ORACLE_BASE>+/u01/app/oracle/g
其他的直接用vim命令修改即可;

注:引數檔案中的路徑引數要與實際的路徑對應;記憶體大小的設定,需要先通過 df -h 命令確認一下,如果設定過大,會報錯:
ORA-00845: MEMORY_TARGET not supported on this system

5.生產spfile引數檔案
echo $ORACLE_SID
sqlplus /nolog
conn /as sysdba
sql> create spfile from pfile;
sql> startup nomount;

6.執行建立資料庫語句
根據官方文件改寫——官方文件參考位置:
Books - Administrator Guide - 2 Create and Configurating an Oracle Database - Step 9:Issue the Create Database Statement

sql> !
$ cd /home/oracle/scripts
$ vim cdb.sh
新增如下內容:
$ cat createdb.sh
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 US7ASCII
   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;

指令碼編寫好後,執行指令碼:
$ exit
SQL> @createdb.sql
Database created.
SQL>
SQL> select instance_name,status from V$instance;

INSTANCE_NAME    STATUS
---------------- ------------
ENMOEDU          OPEN

該步驟預計會執行2分鐘左右,資料庫建立完畢後,自動啟動到open狀態;

7.執行catalog.sql 和 catproc.sql 指令碼
Books - Administrator Guide - 2 Create and Configurating an Oracle Database - Step 11:Run Scripts to build Data Dictionary views

執行必選指令碼:
sql> !
$ cd /home/oracle/scripts
$ vim 1.sh
新增如下內容:
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
conn /as sysdba
@?/sqlplus/admin/pupbld.sql
EXIT
$ exit
sql> @1.sh


資料字典動態效能檢視建立過程:
$ cat cdfixed.sql
$ cat cdcore.sql

8.最後的校驗
sql> select * from v$version;
sql> select instance_name,status from v$instance;

實際的建立過程如下:

[[email protected] ~]# 
[[email protected] ~]# echo "CREATE DATABASE by mamual"
CREATE DATABASE by mamual
[[email protected] ~]# 
[[email protected] ~]# ssh [email protected]
[email protected]'s password: 
Last login: Mon Apr 27 16:30:10 2015 from enmoedu1.example.com
[[email protected] ~]$ 
[[email protected] ~]$ 
[[email protected] ~]$ echo "Step 1: confrate enviroment"
Step 1: confrate enviroment
[[email protected] ~]$ 
[[email protected] ~]$ cd
[[email protected] ~]$ ls 
Desktop  profile_agent  profile_emrep  profile_oms  scripts
[[email protected] ~]$ 
[[email protected] ~]$ ls -a
.              .bash_logout   Desktop   .emacs                .fontconfig  .gnome           .gstreamer-0.10    .java      .nautilus      profile_oms  

.ssh      .zshrc
..             .bash_profile  .dmrc     .emcli                .gconf       .gnome2          .gtkrc-1.2-gnome2  .metacity  profile_agent  .redhat      

.Trash
.bash_history  .bashrc        .eggcups  .emcli.installations  .gconfd      .gnome2_private  .ICEauthority      .mozilla   profile_emrep  scripts      

.viminfo
[[email protected] ~]$ 
[[email protected] ~]$ ps -ef|grep ora_
oracle    4987  4946  0 15:29 pts/1    00:00:00 grep ora_
[[email protected] ~]$ 
[[email protected] ~]$ 
[[email protected] ~]$ vim .bash_profile 
# .bash_profile

# Get the aliases and functions
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=ENMOEDU
export PATH=$ORACLE_HOME/bin:$PATH
~
~
~
~
~
~
~
".bash_profile" 17L, 325C written
[[email protected] ~]$ 
[[email protected] ~]$ 
[[email protected] ~]$ source .bash_profile 
[[email protected] ~]$ 
[[email protected] ~]$ 
[[email protected] ~]$ echo $ORACLE_BASE
/u01/app/oracle
[[email protected] ~]$ 
[[email protected] ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
[[email protected] ~]$ 
[[email protected] ~]$ echo $ORACLE_SID
ENMOEDU
[[email protected] ~]$ 
[[email protected] ~]$ 
[[email protected] ~]$ echo "Step 2: mkdir directory for database"
Step 2: mkdir directory for database
[[email protected] ~]$ 
[[email protected] ~]$ cd $ORACLE_BASE
[[email protected] oracle]$ ll
total 28
drwxr-x---  5 oracle oinstall 4096 Apr 27 12:45 admin
drwxr-xr-x  7 oracle oinstall 4096 Oct 14  2014 cfgtoollogs
drwxr-xr-x  2 oracle oinstall 4096 Oct 14  2014 checkpoints
drwxrwxr-x 11 oracle oinstall 4096 Oct 14  2014 diag
drwxr-x---  4 oracle oinstall 4096 Oct 14  2014 fast_recovery_area
drwxr-x---  5 oracle oinstall 4096 Apr 27 12:45 oradata
drwxr-xr-x  5 oracle oinstall 4096 Oct 14  2014 product
[[email protected] oracle]$ 
[[email protected] oracle]$ cd admin
[[email protected] admin]$ ll
total 12
drwxr-x--- 5 oracle oinstall 4096 Oct 14  2014 EMREP
drwxr-xr-x 3 oracle oinstall 4096 Apr 27 12:45 ENMOEDU
drwxr-x--- 5 oracle oinstall 4096 Oct 14  2014 PROD4
[[email protected] admin]$ rm -fR ENMOEDU/
[[email protected] admin]$ 
[[email protected] admin]$ mkir -p ENOMEDU/admin
-bash: mkir: command not found
[[email protected] admin]$ 
[[email protected] admin]$ mkdir -p ENMOEDU/admin
[[email protected] admin]$ cd ..
[[email protected] oracle]$ pwd
/u01/app/oracle
[[email protected] oracle]$ ll
total 28
drwxr-x---  5 oracle oinstall 4096 Apr 29 15:32 admin
drwxr-xr-x  7 oracle oinstall 4096 Oct 14  2014 cfgtoollogs
drwxr-xr-x  2 oracle oinstall 4096 Oct 14  2014 checkpoints
drwxrwxr-x 11 oracle oinstall 4096 Oct 14  2014 diag
drwxr-x---  4 oracle oinstall 4096 Oct 14  2014 fast_recovery_area
drwxr-x---  5 oracle oinstall 4096 Apr 27 12:45 oradata
drwxr-xr-x  5 oracle oinstall 4096 Oct 14  2014 product
[[email protected] oracle]$ 
[[email protected] oracle]$ 
[[email protected] oracle]$ cd oradata/
[[email protected] oradata]$ ll
total 12
drwxr-x--- 2 oracle oinstall 4096 Oct 14  2014 EMREP
drwxr-xr-x 2 oracle oinstall 4096 Apr 27 15:31 ENMOEDU
drwxr-x--- 2 oracle oinstall 4096 Oct 18  2014 PROD4
[[email protected] oradata]$ 
[[email protected] oradata]$ rm -fR ENMOEDU/
[[email protected] oradata]$ 
[[email protected] oradata]$ mkdir -p ENMOEDU/
[[email protected] oradata]$ 
[[email protected] oradata]$ ll
total 12
drwxr-x--- 2 oracle oinstall 4096 Oct 14  2014 EMREP
drwxr-xr-x 2 oracle oinstall 4096 Apr 29 15:34 ENMOEDU
drwxr-x--- 2 oracle oinstall 4096 Oct 18  2014 PROD4
[[email protected] oradata]$ cd ..
[[email protected] oracle]$ pwd
/u01/app/oracle
[[email protected] oracle]$ 
[[email protected] oracle]$ 
[[email protected] oracle]$ echo "Step 3: create password file for database"
Step 3: create password file for database
[[email protected] oracle]$ 
[[email protected] oracle]$ cd $ORACLE_HOME
[[email protected] db_1]$ ll
[[email protected] db_1]$ cd dbs/
[[email protected] dbs]$ pwd
/u01/app/oracle/product/11.2.0/db_1/dbs
[[email protected] dbs]$ 
[[email protected] dbs]$ 
[[email protected] dbs]$ ls
hc_EMREP.dat    hc_PROD4.dat     init.ora  lkENMOEDU  orapwEMREP    orapwPROD4       spfileENMOEDU.ora
hc_ENMOEDU.dat  initENMOEDU.ora  lkEMREP   lkPROD4    orapwENMOEDU  spfileEMREP.ora  spfilePROD4.ora
[[email protected] dbs]$ 
[[email protected] dbs]$ rm orapwENMOEDU 
[[email protected] dbs]$ rm initENMOEDU.ora 
[[email protected] dbs]$ rm spfileENMOEDU.ora 
[[email protected] dbs]$ 
[[email protected] dbs]$ 
[[email protected] dbs]$ orapwd file=orapwENMOEDU password='oracle' entries=30
[[email protected] dbs]$ ls
hc_EMREP.dat  hc_ENMOEDU.dat  hc_PROD4.dat  init.ora  lkEMREP  lkENMOEDU  lkPROD4  orapwEMREP  orapwENMOEDU  orapwPROD4  spfileEMREP.ora  

spfilePROD4.ora
[[email protected] dbs]$ 
[[email protected] dbs]$ 
[[email protected] dbs]$ echo " Step 4:create pfile from init.ora"
 Step 4:create pfile from init.ora
[[email protected] dbs]$ 
[[email protected] dbs]$ ls
hc_EMREP.dat  hc_ENMOEDU.dat  hc_PROD4.dat  init.ora  lkEMREP  lkENMOEDU  lkPROD4  orapwEMREP  orapwENMOEDU  orapwPROD4  spfileEMREP.ora  

spfilePROD4.ora
[[email protected] dbs]$ 
[[email protected] dbs]$ cat init.ora | grep -v ^# | grep -v ^$ > initENMOEDU.ora
[[email protected] dbs]$ 
[[email protected] dbs]$ cat initENMOEDU.ora 
db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='<ORACLE_BASE>/admin/orcl/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'
control_files = (ora_control1, ora_control2)
compatible ='11.2.0'
[[email protected] dbs]$ 
[[email protected] dbs]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             433G   25G  385G   7% /
tmpfs                 1.5G     0  1.5G   0% /dev/shm
[[email protected] dbs]$ 
[[email protected] dbs]$ vim initENMOEDU.ora 
[[email protected] dbs]$ 
[[email protected] dbs]$ 
[[email protected] dbs]$ echo " Step 5: cteate spfile and startup nomount"
 Step 5: cteate spfile and startup nomount
[[email protected] dbs]$ 
[[email protected] dbs]$ 
[[email protected] dbs]$ echo $ORACLE_SID
ENMOEDU
[[email protected] dbs]$ 
[[email protected] dbs]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Wed Apr 29 15:42:52 2015

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> 
SQL> conn /as sysdba
Connected to an idle instance.
SQL> 
SQL> create spfile from pfile;

File created.

SQL> 
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area  836976640 bytes
Fixed Size                  1348160 bytes
Variable Size             490737088 bytes
Database Buffers          339738624 bytes
Redo Buffers                5152768 bytes
SQL> 
SQL> 
[[email protected] dbs]$ cat initENMOEDU.ora 
[[email protected] scripts]$ cat cdb.sql
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 US7ASCII
   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;
[[email protected] scripts]$ 
[[email protected] scripts]$ vim cdb.sql 
CREATE DATABASE mynewdb
   USER SYS IDENTIFIED BY sys_password
   USER SYSTEM IDENTIFIED BY system_password
           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 US7ASCII
   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
      SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
      SIZE 20M REUSE
      SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
~
~
db_name='ENMOEDU'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/ENMOEDU/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=ORCLXDB)'
open_cursors=300 
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = (/u01/app/oracle/oradata/ENMOEDU/control01.ctl,/u01/app/oracle/oradata/ENMOEDU/control02.ctl)
compatible ='11.2.0'
[[email protected] dbs]$ 
[[email protected] adump]$ 
[[email protected] adump]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Wed Apr 29 15:58:46 2015

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area  836976640 bytes
Fixed Size                  1348160 bytes
Variable Size             490737088 bytes
Database Buffers          339738624 bytes
Redo Buffers                5152768 bytes
SQL> 
SQL> 
SQL> !
[[email protected] adump]$ 
[[email protected] adump]$ 
[[email protected] adump]$ echo "Step 6 : Crate database"
Step 6 : Crate database
[[email protected] adump]$ 
[[email protected] adump]$ cd /home/oracle/scripts/
[[email protected] scripts]$ pwd
/home/oracle/scripts
[[email protected] scripts]$ ll
total 8
-rw-r--r-- 1 oracle oinstall  106 Apr 27 15:35 1.sql
-rw-r--r-- 1 oracle oinstall 1097 Apr 27 15:20 createdb.sql
[[email protected] scripts]$ 
[[email protected] scripts]$ vim cdb.sql
[[email protected] scripts]$ exit
exit
SQL> 
SQL> 
SQL> @/home/oracle/scripts/cdb.sql

Database created.

SQL> 
SQL> 
SQL> !
[[email protected] adump]$ 
[[email protected] adump]$ echo "Step 7 : create dictionaries with scripts"
Step 7 : create dictionaries with scripts
[[email protected] adump]$ 
[[email protected] adump]$ 
[[email protected] adump]$ exit
exit

SQL> 
SQL> !
[[email protected] adump]$ 
[[email protected] adump]$ pwd
/u01/app/oracle/admin/ENMOEDU/adump
[[email protected] adump]$ ll
total 12
-rw-r----- 1 oracle oinstall 732 Apr 29 15:58 ENMOEDU_ora_5813_1.aud
-rw-r----- 1 oracle oinstall 766 Apr 29 15:58 ENMOEDU_ora_5813_2.aud
-rw-r----- 1 oracle oinstall 772 Apr 29 15:58 ENMOEDU_ora_5893_1.aud
[[email protected] adump]$ 
[[email protected] adump]$ 
[[email protected] adump]$ cd /home/oracle/scripts/
[[email protected] scripts]$ ll
total 12
-rw-r--r-- 1 oracle oinstall  106 Apr 27 15:35 1.sql
-rw-r--r-- 1 oracle oinstall 1096 Apr 29 16:05 cdb.sql
-rw-r--r-- 1 oracle oinstall 1097 Apr 27 15:20 createdb.sql
[[email protected] scripts]$ 
[[email protected] scripts]$ cat 1.sql 
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
conn system/oracle
@?/sqlplus/admin/pupbld.sql
EXIT
[[email protected] scripts]$ 
[[email protected] scripts]$ 
[[email protected] scripts]$ exit
exit

SQL> 
SQL> 
SQL> select instance_name,status from V$instance;

INSTANCE_NAME    STATUS
---------------- ------------
ENMOEDU          OPEN

SQL> 
SQL> 
SQL> 
SQL> @/home/oralce/scripts/1.sql
SP2-0310: unable to open file "/home/oralce/scripts/1.sql"
SQL> 
SQL> @/home/oracle/scripts/1.sql
DOC>######################################################################
DOC>######################################################################
DOC>    The following statement will cause an "ORA-01722: invalid number"
DOC>    error and terminate the SQLPLUS session if the user is not SYS.
DOC>    Disconnect and reconnect with AS SYSDBA.
DOC>######################################################################
DOC>######################################################################
DOC>#

no rows selected


Session altered.


TIMESTAMP
------------------------------------------------------------
COMP_TIMESTAMP CATALG_BGN 2015-04-29 16:13:23 2457142 58403


Package created.


Package body created.


Grant succeeded.

...................................

這個是oracle執行自身指令碼的過程;
時間比較長;
中間會報出一些空物件無法刪除的錯誤;
不用擔心,等待全部執行完畢即可。


...................................
QL> DROP SYNONYM PRODUCT_USER_PROFILE;
DROP SYNONYM PRODUCT_USER_PROFILE
             *
ERROR at line 1:
ORA-01434: private synonym to be dropped does not exist


SQL> CREATE SYNONYM PRODUCT_USER_PROFILE FOR SYSTEM.SQLPLUS_PRODUCT_PROFILE;

Synonym created.

SQL> DROP PUBLIC SYNONYM PRODUCT_USER_PROFILE;
DROP PUBLIC SYNONYM PRODUCT_USER_PROFILE
                    *
ERROR at line 1:
ORA-01432: public synonym to be dropped does not exist


SQL> CREATE PUBLIC SYNONYM PRODUCT_USER_PROFILE FOR SYSTEM.PRODUCT_PRIVS;

Synonym created.

SQL> 
SQL> -- End of pupbld.sql
SQL> EXIT
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[[email protected] adump]$ 
[[email protected] adump]$ 
[[email protected] adump]$ echo "Step 8 : check the new database status"
Step 8 : check the new database status
[[email protected] adump]$ 
[[email protected] adump]$ 
[[email protected] adump]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Wed Apr 29 16:21:28 2015

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> conn /as sysdba
Connected.
SQL> 
SQL> 
SQL> 
SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
ENMOEDU          OPEN

SQL> 
SQL> 
SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
PL/SQL Release 11.2.0.3.0 - Production
CORE    11.2.0.3.0      Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

SQL> 
SQL> 

相關推薦

Oracle 11g 手工建立資料庫實驗

Oracle資料庫的手工建庫是依據Oracle資料庫的體系結構,依次建立例項、建立物理結構、建立邏輯結構。 手工建庫一般需要八個步驟: 1.設定oracle使用者環境變數 2.準備資料庫相關目錄 3.生成例項的口令檔案 4.生成例項的pfile引數檔案 5.生成例項的s

Linux 安裝 Oracle 11g——靜默建立資料庫(RAC)

dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName orcl -sid orcl -sysPassword

Oracle 12c 手工建立CDB資料庫

下面我們來看一下,Oracle 12c 如何的來手工建立cdb的資料庫 與10G,11G一樣,建立資料庫的基本的流程是一樣的 1. 手工建立密碼檔案 2. 建立伺服器引數檔案spfile 3. startup nomount 4. 使用create database的語句才

oracle 手工建立資料庫

1:準備初始化的檔案initR43jxgl2.ora。(最好的辦法就是直接到以前的安裝例項中複製一份ora檔案)。 2:用.bat檔案建立相應的檔案,來儲存相關的資料庫資訊。           

oracle 11g 手工冷備

ora-01157 啟動 temp over res 備份日誌 blog lock start 查看數據庫是否處於非歸檔模式關閉數據庫shutdown immediate備份控制文件和數據文件(沒有備份日誌文件,建議一起備份) [oracle@enmoedu1 PROD]$

oracle 11g手工熱備-表空間

shu mat glob 備份 插入數據 mod 插入 rtu rm -rf 手工熱備必須在歸檔模式下進行,只讀表空間不能做熱備,臨時表空間不需要做熱備。 SYS@PROD> archive log list;——開啟了歸檔 Database log mode

oracle 11g 手工熱備-數據庫

sed ora-01157 數據庫 imm line rec ace 系統數據 arch 查看數據庫是否處於歸檔模式,開啟數據庫熱備模式,拷貝操作系統數據庫數據文件到備份目錄 SYS@PROD> archive log list Database log mode

ORACLE PL/SQL Developer連線本地Oracle 11g 64位資料庫

PL/SQL Developer連線本地Oracle 11g 64位資料庫 1.登入PL/SQL Developer 這裡省略Oracle資料庫和PL/SQL Developer的安裝步驟,注意在安裝PL/SQL Developer軟體時,不要安裝在Program Files (x86)目錄下,不然

用Oracle12.2手工建立資料庫的一個坑

作者介紹 楊建榮,DBAplus社群聯合發起人。現就職於搜狐暢遊,Oracle ACE、YEP成員,超7年資料庫開發和運維經驗,擅長電信資料業務、資料庫遷移和效能調優。持Oracle 10G OCP,OCM,MySQL OCP認證,《Oracle DBA工作筆記》作者。 Oracle 12cR2推出

Oracle學習之建立資料庫(新建例項)

出處:http://blog.csdn.net/luiseradl/article/details/6972217 http://wenku.baidu.com/view/864b9b2c453610661ed9f469.html My points: (1)我的頭頭說一般不需要建立資料庫,在Orcl資料庫

ORACLE中用DBCA建立資料庫

用DBCA在ORACLE中建立資料庫,名稱為njdb 一、開啟命令視窗,命令列中輸入DBCA,彈出資料庫配置助手視窗,如下圖: 下一步,進入到“操作”視窗。 第二步,資料庫模板 第三

ORACLE利用模板建立資料庫

1. 準備檔案:模板檔案,該檔案可在ORACLE安裝好的路徑中獲得$ORACLE_HOME/assistants/dbca/templates/下有模板檔案Data_warehouse.dbc、General_purpose.dbc 我們一般用第二個檔案就可以了 還需要一個

Linux 安裝 Oracle 11g——手工建庫(RAC)

 建立目錄mkdir -p /u01/app/oracle/admin/orcl/adump編輯引數檔案*.memory_target=512m*.audit_file_dest='/u01/ap

ORACLE 11G 手工建庫

 原創作品,出自 “深藍的blog” 部落格,歡迎轉載,轉載時請務必註明以下出處,否則追究版權法律責任。 第一步:目錄 --資料庫檔案目錄 $ cd $ORACLE_BASE/oradata $

PL/SQL Developer連線本地Oracle 11g 64位資料庫

今天在虛擬機器裡安裝了一個Oracle 11g 64位版本,在用PL/SQL Developer連線時,發現竟然沒有資料庫連線TNS。以為是PL/SQL Developer沒有識別到Oracle Hom和OCI Libaray 。 就以非登入模式進入PL/SQL Devel

Oracle 11g 怎麼建立使用者 用sqlplus創使用者的具體步驟

開始--執行--- cmd --- sqlplus /nolog conn / as sysdba; CREATE USER "AAA" PROFILE "DEFAULT" IDENTIFIED BY "AAA" DEFAULT TABLESPACE "USER" TEMPORAR

oracle 11g 表空間遷移 實驗過程

 參考文件:在複製或移動表空間前,使用者首先將表空間置於只讀狀態,再複製表空間的資料檔案(datafile),最後使用export/import工具遷移位於資料字典(data dictionary)中的資料庫元資料資訊(database metadata informatio

windows 8 安裝oracle 12c dbca建立資料庫報錯建立服務出錯

          在windows 8 上安裝oracle 12c dbca建立資料庫報錯如下: 在建立服務時報錯,報拒絕訪問 這個問題糾結了很久,是許可權問題,但是作業系統使用者賦予管理員許可權了,但是dbca建立還是報這個錯誤     後來想了一下普通使用者執行c

oracle 11g 資料庫表空間建立與資料匯入匯出

** oracle資料庫中進行資料的匯入匯出時要在cmd中進行而不是在sqlplus中進行操作! (1)向oracle資料庫中匯入完整的資料庫(字尾名:dmp)      首先進入cmd,輸入sqlplus /nolog執行oracle自帶程式,

centos 安裝oracle 11g r2(二)-----監聽配置與建立資料庫例項

一、監聽配置(命令:netca) 1、以 oracle 使用者輸入命令,啟動圖形化工具配置監聽 [[email protected] ~]$ netca 2、選擇==++Add++== 3、預設監聽名稱,直接下一步 二、建立資料庫例項(命令:dbca)-----需要確