1.配置hostname
我們提供的服務(wù)有:網(wǎng)站制作、網(wǎng)站建設(shè)、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、遷西ssl等。為數(shù)千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的遷西網(wǎng)站制作公司
[root@oracledb ~]#hostnamectl set-hostname oracledb
[root@oracledb ~]#echo " 10.100.1.10 oracledb" /etc/hosts
2.關(guān)閉selinux和防火墻
[root@oracledb ~]#sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
[root@oracledb ~]#setenforce 0
[root@oracledb ~]#systemctl stop firewalld
[root@oracledb ~]#systemctl disable firewalld
[root@oracledb ~]#systemctl status firewalld
3.下載Oracle軟件包 且上傳到服務(wù)器上,進(jìn)行解壓縮
建議使用winSCP工具進(jìn)行上傳到服務(wù)器的/opt目錄下
[root@oracledb ~]# ls -lh /opt/
-rw-r--r-- 1 root root 1.2G Mar 30 16:12 linux.x64_11gR2_database_1of2.zip
-rw-r--r-- 1 root root 1.1G Mar 30 16:11 linux.x64_11gR2_database_2of2.zip
4.安裝oracle環(huán)境所需要的依賴包-配置YUM源
安裝依賴包之前,一定要設(shè)置好服務(wù)器上的安裝源,原因是:可以在沒有互聯(lián)網(wǎng)的時(shí)候安裝服務(wù)所需依賴包;常用的安裝源有兩種方式:
(1) 配置本地yum源
新建配置文件vi /etc/yum.repos.d/localsource.repo輸入如下內(nèi)容:
[localsource]
name=localsource
baseurl=
enabled=1
gpgcheck=0
(2) 生成本地yum 緩存
注意:從Oracle 11g 11.2.0.2版本開始,在Linux x86_64上安裝時(shí),只需要安裝64位的軟件包,但是,對(duì)于11.2.0.2之前的任何Oracle database 11g,下表中列出的32位和64位的安裝包都必須安裝
5.安裝oracle環(huán)境所需要的依賴包-安裝依賴包
(1)安裝依賴包
[root@oracledb ~]# yum -y install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel zlib zlib-devel pcre-devel unzip
(2)安裝完成后,檢查依賴是否全部安裝成功
[root@oracledb ~]# rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel zlib zlib-devel pcre-devel unzip | grep "not installed"
(3)創(chuàng)建所需的用戶組和用戶
如果要安裝Oracle數(shù)據(jù)庫,通常需要以下本地操作系統(tǒng)用戶組和用戶:
Oracle inventory組(通常為 oinstall)
OSDBA組 (通常為 dba)
OSOPER組 (通常為 oper)
Oracle軟件所有者(通常為 oracle)
創(chuàng)建用戶組和用戶:
[root@oracledb ~]# groupadd oinstall
[root@oracledb ~]# groupadd dba
[root@oracledb ~]# groupadd oper
[root@oracledb ~]# useradd -g oinstall -G dba oracle
(4)修改oracle用戶密碼:建議密碼配置為字符+數(shù)字+特殊字符
[root@oracledb ~]# passwd oracle
6.配置內(nèi)核參數(shù)和資源限制
(1)編輯配置文件vi /etc/sysctl.conf添加如下參數(shù):
vm.max_map_count = 655360
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2147483648 ###最小值: 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
注意:如果系統(tǒng)中某個(gè)參數(shù)高于上面的參數(shù)的值 ,保留較大的值,上面的數(shù)值只是官方要求的最小值,可以根據(jù)系統(tǒng)調(diào)整數(shù)值,以優(yōu)化系統(tǒng)性能
(2)使內(nèi)核參數(shù)生效
[root@oracledb ~]# sysctl -p
7.創(chuàng)建oracle安裝目錄
如下目錄,根據(jù)自己的實(shí)際情況可做修改:
[root@oracledb ~]# mkdir -p /data/app/oracle/product/11.2.0
[root@oracledb ~]# cd /data/app/oracle/
[root@oracledb oracle]# mkdir oradata inventory fast_recovery_area
[root@oracledb ~]# chown -R oracle:oinstall /data/app/oracle
[root@oracledb ~]# chmod -R 775 /data/app/oracle
8.配置oracle用戶環(huán)境變量
編輯配置文件vi /home/oracle/.bash_profile添加如下內(nèi)容:
export ORACLE_BASE=/data/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
9. 解壓下載好的兩個(gè)Oracle數(shù)據(jù)庫文件
[root@oracledb ~]# cd /opt
[root@oracledb ~]# unzip linux.x64_11gR2_database_1of2.zip -d /data
[root@oracledb ~]# unzip linux.x64_11gR2_database_2of2.zip -d /data
10. 編輯靜默安裝響應(yīng)文件
(1)切換到oracle用戶執(zhí)行
[root@oracledb ~]# su - oracle
(2)切換到響應(yīng)文件的目錄下
[oracle@oracledb ~]$ cp -R /data/database/response/ .
[oracle@oracledb ~]$ cd response/
[oracle@oracledb response]$ ls
dbca.rsp db_install.rsp netca.rsp
11.修改配置文件:vi /home/oracle/response/db_install.rsp,修改以下變量的值
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/app/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/data/app/oracle/product/11.2.0
ORACLE_BASE=/data/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true
12. 開始靜默安裝Oracle 11g
(1)開始安裝oracle數(shù)據(jù)庫
[oracle@oracledb ~]$ cd /data/database
[oracle@oracledb ~]$ ./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq
注意:安裝期間可以使用tail命令查看oracle的安裝日志,且日志文件名稱是根
據(jù)自己的實(shí)際執(zhí)行時(shí)間確定的,安裝日志文件會(huì)在安裝時(shí)提示,需要等待3分鐘左右,注意不要停止運(yùn)行;安裝完成后有如下提示,如果有類似如下提示,說明安裝完成。
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/data/app/oraInventory/orainstRoot.sh
/data/app/oracle/product/11.2.0/db_1/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
4. Return to this window and hit "Enter" key to continue
Successfully Setup Software.
13.使用 root用戶執(zhí)行腳本
(1)切換到root用戶執(zhí)行
[root@oracledb ~]# su - root
(2)執(zhí)行兩個(gè)用戶腳本
[root@oracledb ~]# sh /data/app/oracle/inventory/orainstRoot.sh
[root@oracledb ~]# sh /data/app/oracle/product/11.2.0/root.sh
14.配置監(jiān)聽程序
(1)切換到oracle用戶執(zhí)行(建議退出重進(jìn)oracle用戶)
[root@oracledb ~]# su - oracle
(2)配置監(jiān)聽,查看輸出結(jié)果
[oracle@oracledb ~]$ netca /silent /responsefile /home/oracle/response/netca.rsp
(3)查看監(jiān)聽服務(wù)狀態(tài),若沒啟動(dòng)需要啟動(dòng)
[oracle@oracledb ~]$ lsnrctl status
[oracle@oracledb ~]$ lsnrctl start
查看結(jié)果:
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /data/etc/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/data/app/oracle/product/11.2.0/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
(4)查看監(jiān)聽端口
[oracle@oracledb ~]$ netstat -tnpl | grep 1521
15.靜默創(chuàng)建數(shù)據(jù)庫
GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION =/data/app/oracle/oradata
RECOVERYAREADESTINATION=/data/app/oracle/fast_recovery_area
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = " 6552 "
##其中TOTALMEMORY = " 6552 " 為6552 MB,物理內(nèi)存8G*80%
(2)切換到oracle用戶執(zhí)行
[root@oracledb ~]# su - oracle
(3)執(zhí)行靜默建庫
[oracle@oracledb ~]$ dbca -silent -responseFile /home/oracle/response/dbca.rsp
執(zhí)行過程如下:
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/data/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
(4)查看進(jìn)程
[oracle@oracledb ~]$ ps -ef | grep ora_ | grep -v grep
(5)再次查看監(jiān)聽狀態(tài)進(jìn)行確認(rèn)
[oracle@oracledb ~]$ lsnrctl status
結(jié)果顯示:
The command completed successfully
16.至此數(shù)據(jù)庫就安裝成功了,下面我們登錄下數(shù)據(jù)庫
(1)切換到oracle用戶執(zhí)行
[root@oracledb ~]# su - oracle
(2)登錄數(shù)據(jù)庫
[oracle@oracledb ~]$ sqlplus / as sysdba
(3)查詢實(shí)例狀態(tài)
SQLselect status from v$instance;
(4)查看數(shù)據(jù)庫版本
SQL select * from v$version;
(5)激活scott用戶
SQLalter user scott account unlock;
SQLalter user scott identified by tiger;
SQLselect username,account_status from dba_users;
17.設(shè)置Oracle開機(jī)啟動(dòng)
(1)修改配置文件vi /data/app/oracle/product/11.2.0/bin/dbstart 修改如下內(nèi)容:
將腳本中的ORACLE_HOME_LISTNER=$1,修改為ORACLE_HOME_LISTNER=$ORACLE_HOME
(2)修改配置文件vi /data/app/oracle/product/11.2.0/bin/dbshut 修改如下內(nèi)容:
將腳本中的ORACLE_HOME_LISTNER=$1,修改為ORACLE_HOME_LISTNER=$ORACLE_HOME
(3)修改配置文件 vi /etc/oratab修改如下內(nèi)容,
orcl:/data/app/oracle/product/11.2.0:Y
(4)新建文件:vi /etc/rc.d/init.d/oracle 注意:建議全部復(fù)制腳本內(nèi)容
#! /bin/bash
# oracle: Start/Stop Oracle Database 11g R2
# chkconfig: 345 90 10
# description: The Oracle Database is an Object-Relational Database Management System.
# processname: oracle
. /etc/rc.d/init.d/functions
LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/data/app/oracle/product/11.2.0
ORACLE_USER=oracle
case "$1" in
start)
if [ -f $LOCKFILE ]; then
echo $0 already running.
exit 1
fi
echo -n #34;Starting Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch $LOCKFILE
;;
stop)
if [ ! -f $LOCKFILE ]; then
echo $0 already stopping.
exit 1
fi
echo -n #34;Stopping Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
rm -f $LOCKFILE
;;
restart)
$0 stop
$0 start
;;
status)
if [ -f $LOCKFILE ]; then
echo $0 started.
else
echo $0 stopped.
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
exit 1
esac
exit 0
(5)給 /etc/init.d/oracle添加執(zhí)行權(quán)限
[root@oracledb ~]# chmod +x /etc/init.d/oracle
(6)開機(jī)啟動(dòng)oracle
[root@oracledb ~]# chkconfig oracle on
(7)給啟動(dòng)文件加權(quán)限
[root@oracledb ~]# cd /data/app/oracle/product/11.2.0/bin/
[root@oracledb bin]# chmod 6751 oracle
[root@oracledb bin]# cd /var/tmp
[root@oracledb tmp]# chown -R oracle:oinstall .oracle
(8)重啟測試
[root@oracledb ~]# reboot
(9)切換到oracle用戶登錄狀態(tài)下
[root@oracledb ~]# su - oracle
[oracle@oracledb ~]$ sqlplus / as sysdba
(10)解除鎖定
SQL alter user SYSTEM account unlock;
(11)這時(shí)候就可以用Navicat連接了
SQL conn;
用戶名:SYSTEM
密碼:oracle
如果不能正確連接,改下密碼試試
alter user system identified by 新密碼
[root@oracledb ~]# mkdir -p /data/szzt
[root@oracledb ~]# cd /data/
[root@oracledb data]# chown oracle:oinstall -R szzt
[root@oracledb data]# ll
total 0
drwxr-xr-x 3 root root 20 Apr 8 21:14 app
drwxr-xr-x 8 root root 128 Aug 21 2009 database
drwxr-xr-x 2 oracle oinstall 6 Apr 14 16:17 szzt
[root@oracledb ~]# su - oracle
[oracle@oracledb ~]$ sqlplus / as sysdba
SQL conn cshi
Enter password: 登錄失敗
Connected.
SQL create temporary tablespace DB_DATA_TMP tempfile'/data/szzt/DB_DATA_TMP.dbf' size 500m autoextend on next 100m maxsize 10240m extent management local;
顯示結(jié)果:
Tablespace created.
SQL create tablespace DB_DATA logging datafile'/data/szzt/DB_DATA.dbf' size 2048m autoextend on next 100m maxsize 10240m extent management local;
顯示結(jié)果:
Tablespace created.
SQL create user ceshi identified by ceshi default tablespace DB_DATA temporary tablespace DB_DATA_TMP;
顯示結(jié)果:
User created.
SQL grant dba to ceshi;
顯示結(jié)果:
Grant succeeded.
SQL conn ceshi ###用戶名和密碼一樣,此時(shí)登錄成功
[oracle@oracledb ~]$ cd /data/app/oracle/product/11.2.0/bin/
注意:數(shù)據(jù)庫導(dǎo)出操作是在 源服務(wù)器 上進(jìn)行
[oracle@oracledb bin]$ exp 用戶名/密碼@ IP地址 /orcl file =/data/szzt/ceshi.dmp owner='用戶名'
Export terminated successfully without warnings.
注意:數(shù)據(jù)庫導(dǎo)入操作是在 目標(biāo)服務(wù)器 上進(jìn)行
[oracle@oracledb bin]$ imp ceshi/ceshi@ 10.100.1.10 /orcl file=/data/szzt/ceshi.dmp fromuser=ceshi touser=ceshi
顯示結(jié)果:可以看到導(dǎo)入的表過程(10.100.1.10是自己的目標(biāo)數(shù)據(jù)庫服務(wù)器)
Import terminated successfully without warnings .
(1)、數(shù)據(jù)導(dǎo)入完畢后,我們可以使用DBeaver對(duì)數(shù)據(jù)庫進(jìn)行遠(yuǎn)程管理
(2)、測試連接,沒問題后完成新建
(3)、連接上來后,我們就可以使用工具來進(jìn)行管理數(shù)據(jù)庫
1、首先點(diǎn)擊桌面左下角的開始菜單按鈕在打開的選擇窗口中找到圖中的選項(xiàng),點(diǎn)擊打開窗口界面即可。
2、然后在如圖所示的界面中選擇創(chuàng)建數(shù)據(jù)庫的選項(xiàng),再點(diǎn)擊next即可即可。
3、然后打開圖中的設(shè)置窗口,選擇第一項(xiàng)使用默認(rèn)的配置然后按照提示輸入對(duì)應(yīng)的選項(xiàng)和驗(yàn)證信息即可。
4、這里是剛剛設(shè)置的信息選項(xiàng),可以檢查一些主要的信息確認(rèn)后即可點(diǎn)擊next按鈕繼續(xù)就是說開始創(chuàng)建了。
5、等待即可,中途不需要手動(dòng)設(shè)置修改。數(shù)據(jù)庫創(chuàng)建完成后,點(diǎn)擊關(guān)閉按鈕關(guān)閉創(chuàng)建向?qū)Ы缑?,即可新建一個(gè)數(shù)據(jù)庫。
1. 什么平臺(tái)?版本?
vm workstation
2.基本Linux命令
3.安裝oracle 11g
4.常用工具:sqlplus em /oracle sql developer
5.會(huì)寫shell腳本
6.遠(yuǎn)程工具(系統(tǒng)要安裝ssh)
putty /crt /xmanager
7.上傳工具
ftp 缺點(diǎn):要開端口 scp /winscp/ fz--fillzilla
8.把圖像傳到操作機(jī)器上
測試工具:xclock
借助工具:Xmanager
9.聯(lián)機(jī)文檔
10.安裝軟件包 rpm -qa / rpm -ivh
創(chuàng)建表空間的基礎(chǔ)語法:
create tablespace 表間名 datafile '數(shù)據(jù)文件名' size 表空間大小;
創(chuàng)建表并指定表空間
create user news identified by news default tablespace news_tablespace;
授權(quán)表空間:
grant dba to news; --表示把 dba權(quán)限授予給news用戶 授權(quán)成功
操作順序如下:
1.創(chuàng)建實(shí)例啟動(dòng)用的參數(shù)文件。在程序默認(rèn)的參數(shù)文件里修改即可:重命名規(guī)則 initSID.ora
/u01/oracle/product/11.2.0/db_1/dbs/ 下,目錄盡量使用絕對(duì)路徑,采用ORACLE_BASE等環(huán)境變量有可能報(bào)錯(cuò)。
例 initcrm.ora
db_name='crm' --修改
#memory_target=500m --注釋掉
sga_target=200m --添加
pga_aggregate_target=60m --添加
processes = 150
audit_file_dest='/u01/oracle/admin/crm/adump' --建立目錄
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/oracle/flash_recovery_area' --建立目錄
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/oracle' ---修改
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
2.創(chuàng)建相應(yīng)目錄:
mkdir -p /u01/oracle/admin/ora11g/adump
mkdir -p /u01/oracle/admin/ora11g/dpdump
mkdir -p /u01/oracle/flash_recovery_area
3.創(chuàng)建密碼文件:命名規(guī)則 orapwSID,目錄依舊是 /u01/oracle/product/11.2.0/db_1/dbs/
Linux下orapw+實(shí)例名
Windows下pwd+實(shí)例名
$ orapwd file=orapwora11g password=oracle
4.創(chuàng)建數(shù)據(jù)庫實(shí)例
設(shè)置環(huán)境變量 export ORACLE_SID=crm
執(zhí)行以下命令
sqlplus /nolog
conn / as sysdba
注意:本處可能報(bào)錯(cuò)需要可能的原因: a)glibc-devel-2.5-58.el5_6.4、libaio-0.3.106-5包是否已安裝,命令分別為rpm -q glibc-devel、rpm -q libaio
b)oracle目錄權(quán)限不足或?qū)俳M不對(duì),chmod 6751 oracle 授權(quán)、chown -R oracle.oinstall /u01/oracle 修改屬組
執(zhí)行建庫腳本:
startup nomount pfile="/u01/oracle/product/11.2.0.1/db1/dbs/initcrm.ora";
CREATE DATABASE "crm"
MAXINSTANCES 8
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
DATAFILE '/u01/oracle/oradata/system01.dbf' SIZE 1024M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/oracle/oradata/sysaux01.dbf' SIZE 500M REUSE
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/oracle/oradata/temp01.dbf' SIZE 20M REUSE
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/u01/oracle/oradata/undo01.dbf' SIZE 300M REUSE
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('/u01/oracle/oradata/log01.dbf') SIZE 50M,
GROUP 2 ('/u01/oracle/oradata/log02.dbf') SIZE 50M,
GROUP 3 ('/u01/oracle/oradata/log03.dbf') SIZE 50M;
創(chuàng)建USERS表空間
CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/u01/app/oradata/user01.dbf' SIZE 1000M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
ALTER DATABASE DEFAULT TABLESPACE "USERS";
------------------------------------------
SQL create spfile from pfile;
File created.
-----------------------------------------
sqlplus / as sysdba
SQL show user;
@/u01/oracle/product/11.2.0.1/db1/rdbms/admin/catalog.sql;
@/u01/oracle/product/11.2.0.1/db1/rdbms/admin/catblock.sql;
@/u01/oracle/product/11.2.0.1/db1/rdbms/admin/catproc.sql;
@/u01/oracle/product/11.2.0.1/db1/rdbms/admin/catoctk.sql;
@/u01/oracle/product/11.2.0.1/db1/rdbms/admin/owminst.plb;
使用system用戶編譯
@/u01/oracle/product/11.2.0.1/db1/sqlplus/admin/pupbld.sql;
@/u01/oracle/product/11.2.0.1/db1/sqlplus/admin/help/hlpbld.sql helpus.sql;
使用sys用戶編譯
@/u01/oracle/product/11.2.0.1/db1/javavm/install/initjvm.sql;
@/u01/oracle/product/11.2.0.1/db1/xdk/admin/initxml.sql;
@/u01/oracle/product/11.2.0.1/db1/xdk/admin/xmlja.sql;
@/u01/oracle/product/11.2.0.1/db1/rdbms/admin/catjava.sql;
@/u01/oracle/product/11.2.0.1/db1/rdbms/admin/catexf.sql;
@/u01/oracle/product/11.2.0.1/db1/rdbms/admin/catqm.sql change_on_install SYSAUX TEMP YES;
@/u01/oracle/product/11.2.0.1/db1/rdbms/admin/catxdbj.sql;
@/u01/oracle/product/11.2.0.1/db1/rdbms/admin/catrul.sql;
spool /oracle/admin/edidb/scripts/ordinst.log append
@/u01/oracle/product/11.2.0.1/db1/ord/admin/ordinst.sql SYSAUX SYSAUX;
spool off
spool /u01/oracle/admin/ora11g/scripts/interMedia.log append
@/u01/oracle/product/11.2.0.1/db1/ord/im/admin/iminst.sql;
spool off
set echo on
spool /oracle/admin/edidb/scripts/lockAccount.log append
BEGIN
FOR item IN ( SELECT USERNAME FROM DBA_USERS WHERE ACCOUNT_STATUS IN ('OPEN', 'LOCKED', 'EXPIRED') AND USERNAME NOT IN (
'SYS','SYSTEM') )
LOOP
dbms_output.put_line('Locking and Expiring: ' || item.USERNAME);
execute immediate 'alter user ' ||
sys.dbms_assert.enquote_name(
sys.dbms_assert.schema_name(
item.USERNAME),false) || ' password expire account lock' ;
END LOOP;
END;
/
spool off
到此,數(shù)據(jù)庫實(shí)例建立完畢。