Oracle手动建库常见问题
BLOG文档结构图
前言部分
导读和注意事项
各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:
①10G和11g手动建库(重点)
②各种组件安装
③创建Sample Schemas数据
④手动建库中常用脚本的解释
⑤sqlplus中的帮助命令
Tips:
③ 若文章代码格式有错乱,推荐使用搜狗、360或QQ浏览器,也可以下载pdf格式的文档来查看,pdf文档下载地址:http://blog.itpub.net/26736162/viewspace-1624453/
④ 本篇BLOG中命令的输出部分需要特别关注的地方我都用灰色背景和粉红色字体来表示,比如下边的例子中,thread 1的最大归档日志号为33,thread 2的最大归档日志号为43是需要特别关注的地方;而命令一般使用黄色背景和红色字体标注;对代码或代码输出部分的注释一般采用蓝色字体表示。
本文如有错误或不完善的地方请大家多多指正,ITPUB留言或QQ皆可,您的批评指正是我写作的最大动力。
本文简介
上一篇(http://blog.itpub.net/26736162/viewspace-2121930/)中最后差了手动建库的部分,今天把这个部分的内容加上。本来手动建库很早就学习过了,只是一直没有时间来整理发布,今天就趁这个机会正好整理一下,分享给大家。
小麦苗学习手动建库的动力源于之前帮网友采用dbca建库的时候报错,由于java环境的问题,dbca一直没有办法使用,无论界面还是静默都用到java,折腾了2个小时还是把java没有修复好,dbca不能用,最后想到了create database手动建库,虽然工作中很少采用但还是有一定的用途的。
手动建库简介
有时候因为环境的缘故不能使用图形界面或者不能使用dbca的静默方式来创建一个新库,那么这个时候可以考虑使用CREATE DATABASE SQL命令行来创建数据库,该方式是一种手动建库方式,使用此种命令行手动创建数据库的优点是:可以用脚本来创建数据库。 另外OCM的考试中要求我们用CREATE DATABASE来创建数据库。当然在使用脚本创建数据库时,在建立数据字典视图和安装标准的PL/SQL程序包时,必须先建立一个可以操作的数据库。
手动建库基本步骤
官方文档的步骤:
直接给出脚本
我们直接给出手动建库用到的脚本,至于过程小麦苗就不演示了。
11G
ORACLE用户执行 数据文件在文件系统 单实例DB
------------ 1、 确保环境变量正确
export ORACLE_SID=lhrdb
env|grep ORACLE
ORACLE_SID=lhrdb
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
------------ 2、 创建密码文件
orapwd file=$ORACLE_HOME/dbs/orapwlhrdb password=lhr force=y
------------ 3、 创建初始化参数文件和相关路径
$ORACLE_HOME/dbs/initlhrdb.ora
db_name='lhrdb'
memory_target=400437056
processes = 150
audit_file_dest='/u01/app/oracle/admin/lhrdb/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_create_file_dest='/u01/app/oracle/oradata'
db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=MYNEWDBXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = '/u01/app/oracle/oradata/lhrdb/control01.ctl','/u01/app/oracle/flash_recovery_area/lhrdb/control02.ctl'
compatible ='11.2.0'
mkdir -p /u01/app/oracle/admin/lhrdb/adump
mkdir -p /u01/app/oracle/flash_recovery_area/lhrdb/
mkdir -p /u01/app/oracle/oradata/lhrdb/
------------ 4、 创建spfile,启动到nomount状态
sqlplus / as sysdba
create spfile from pfile;
startup nomount
! ps -ef|grep lhrdb
------------ 5、 创建DB
CREATE DATABASE lhrdb
USER SYS IDENTIFIED BY lhr
USER SYSTEM IDENTIFIED BY lhr
CONTROLFILE REUSE
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
ARCHIVELOG
MAXLOGFILES 192 MAXLOGMEMBERS 5 MAXLOGHISTORY 292 MAXDATAFILES 1024 MAXINSTANCES 32
LOGFILE GROUP 1('/u01/app/oracle/oradata/lhrdb/redo01a.log','/u01/app/oracle/oradata/lhrdb/redo01b.log') SIZE 50M BLOCKSIZE 512,
GROUP 2('/u01/app/oracle/oradata/lhrdb/redo02a.log','/u01/app/oracle/oradata/lhrdb/redo02b.log') SIZE 50M blocksize 512,
GROUP 3('/u01/app/oracle/oradata/lhrdb/redo03a.log','/u01/app/oracle/oradata/lhrdb/redo03b.log') SIZE 50M BLOCKSIZE 512
DATAFILE '/u01/app/oracle/oradata/lhrdb/system01.dbf' SIZE 300M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 10G
SYSAUX DATAFILE '/u01/app/oracle/oradata/lhrdb/sysaux01.dbf' SIZE 100M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 10G
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/app/oracle/oradata/lhrdb/temp01.dbf' SIZE 10M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 1G
UNDO TABLESPACE UNDOTBS1 DATAFILE '/u01/app/oracle/oradata/lhrdb/undotbs01.dbf'SIZE 10M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 1G
DEFAULT TABLESPACE USERS DATAFILE '/u01/app/oracle/oradata/lhrdb/users01.dbf' SIZE 10M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 10G
/
SPOOL /tmp/dictionary_tmp.sql
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/catclust.sql
@?/rdbms/admin/dbmspool.sql
@?/rdbms/admin/catblock.sql
@?/rdbms/admin/caths.sql
@?/rdbms/admin/owminst.plb
@?/sqlplus/admin/plustrce.sql
@?/rdbms/admin/utlrp.sql
@?/rdbms/admin/utlsampl.sql
conn system/lhr
@?/sqlplus/admin/pupbld.sql
@?/sqlplus/admin/help/hlpbld.sql helpus.sql
SPOOL off
------ 单实例数据库添加到srvctl中
srvctl add database -d lhrdb -c single -o /u01/app/oracle/product/11.2.0/dbhome_1 -p '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilelhrdb.ora' -r primary -n lhrdb -x ZFXDESKDB2
srvctl config database -d lhrdb -a
srvctl status database -d lhrdb
srvctl start database -d lhrdb
crsctl stat res -t
------ drop database
alter database close;
alter system enable restricted session;
drop database;
ORACLE用户执行 数据文件在ASM中 单实例DB
------------ 1、 确保环境变量正确
export ORACLE_SID=lhrasm
env|grep ORACLE
ORACLE_SID=lhrasm
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
------------ 2、 创建密码文件
orapwd file=$ORACLE_HOME/dbs/orapwlhrasm password=lhr force=y
------------ 3、 创建初始化参数文件和相关路径
$ORACLE_HOME/dbs/initlhrasm.ora
db_name='lhrasm'
memory_target=400437056
processes = 150
audit_file_dest='/u01/app/oracle/admin/lhrasm/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_create_file_dest='+DATA'
db_recovery_file_dest='+FRA'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=MYNEWDBXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = '+DATA/lhrasm/controlfile/control01.ctl','+FRA/lhrasm/controlfile/control02.ctl'
compatible ='11.2.0'
mkdir -p /u01/app/oracle/admin/lhrasm/adump
mkdir -p /u01/app/oracle/flash_recovery_area/lhrasm/
mkdir -p /u01/app/oracle/oradata/lhrasm/
------------ 4、 创建spfile,启动到nomount状态
sqlplus / as sysdba
create spfile from pfile;
startup nomount
! ps -ef|grep lhrasm
------------ 5、 创建DB
CREATE DATABASE lhrasm
USER SYS IDENTIFIED BY lhr
USER SYSTEM IDENTIFIED BY lhr
CONTROLFILE REUSE
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
ARCHIVELOG
MAXLOGFILES 192 MAXLOGMEMBERS 5 MAXLOGHISTORY 292 MAXDATAFILES 1024 MAXINSTANCES 32
LOGFILE GROUP 1('+DATA','+DATA') SIZE 50M BLOCKSIZE 512,
GROUP 2('+DATA','+DATA') SIZE 50M blocksize 512,
GROUP 3('+DATA','+DATA') SIZE 50M BLOCKSIZE 512
DATAFILE '+DATA' SIZE 300M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 10G
SYSAUX DATAFILE '+DATA' SIZE 100M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 10G
SET DEFAULT bigfile TABLESPACE
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '+DATA' SIZE 10M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 1G
UNDO TABLESPACE UNDOTBS1 DATAFILE '+DATA'SIZE 10M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 1G
DEFAULT TABLESPACE USERS DATAFILE '+DATA' SIZE 10M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 1G
;
/* --------- BIGFILE
CREATE DATABASE lhrasm
USER SYS IDENTIFIED BY lhr
USER SYSTEM IDENTIFIED BY lhr
CONTROLFILE REUSE
EXTENT MANAGEMENT LOCAL
SET DEFAULT bigfile TABLESPACE
DEFAULT TEMPORARY TABLESPACE TEMP
UNDO TABLESPACE UNDOTBS1
DEFAULT TABLESPACE USERS
;
*/
SPOOL /tmp/dictionary_tmp.sql
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/catclust.sql
@?/rdbms/admin/dbmspool.sql
@?/rdbms/admin/catblock.sql
@?/rdbms/admin/caths.sql
@?/rdbms/admin/owminst.plb
@?/sqlplus/admin/plustrce.sql
@?/rdbms/admin/utlrp.sql
@?/rdbms/admin/utlsampl.sql
conn system/lhr
@?/sqlplus/admin/pupbld.sql
@?/sqlplus/admin/help/hlpbld.sql helpus.sql
SPOOL off
------ 单实例数据库添加到srvctl中
srvctl add database -d lhrasm -c single -o /u01/app/oracle/product/11.2.0/dbhome_1 -p '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilelhrasm.ora' -r primary -n lhrasm -x ZFXDESKDB2
srvctl config database -d lhrasm -a
srvctl status database -d lhrasm
srvctl start database -d lhrasm
crsctl stat res -t
------ drop database
alter database close;
alter system enable restricted session;
drop database;
11G rac asm
---- 思路:先创建单实例DB然后再转换为RAC DB
export ORACLE_SID=raclhr1
env|grep ORACLE
ORACLE_SID=raclhr
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
------------ 2、 2个节点都 创建密码文件
orapwd file=$ORACLE_HOME/dbs/orapwraclhr1 password=lhr force=y
orapwd file=$ORACLE_HOME/dbs/orapwraclhr2 password=lhr force=y
------------ 3、 创建初始化参数文件和相关路径
--- 节点一配置:
$ORACLE_HOME/dbs/initraclhr1.ora
*.db_name='raclhr'
*.memory_target=400437056
*.processes = 150
*.open_cursors=300
*.audit_file_dest='/u01/app/oracle/admin/raclhr/adump'
*.audit_trail ='db'
*.db_block_size=8192
*.db_domain=''
*.db_create_file_dest='+DATA'
*.db_recovery_file_dest='+FRA'
*.db_recovery_file_dest_size=2G
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=MYNEWDBXDB)'
*.control_files = '+DATA/raclhr/controlfile/control01.ctl','+FRA/raclhr/controlfile/control02.ctl'
*.remote_login_passwordfile='EXCLUSIVE'
---2个节点都创建路径
mkdir -p /u01/app/oracle/admin/raclhr/adump
mkdir -p /u01/app/oracle/flash_recovery_area/raclhr/
mkdir -p /u01/app/oracle/oradata/raclhr/
--- 节点一执行
su - grid
asmcmd
cd +DATA
mkdir raclhr
cd raclhr
mkdir PARAMETERFILE
su - oracle
sqlplus / as sysdba
create spfile='+DATA/raclhr/PARAMETERFILE/spfileraclhr.ora' from pfile;
---2个节点都执行 创建初始化参数文件执行ASM磁盘里的SPFILE
cp $ORACLE_HOME/dbs/initraclhr1.ora $ORACLE_HOME/dbs/initraclhr1.ora_bk
echo "spfile='+DATA/raclhr/PARAMETERFILE/spfileraclhr.ora'" > $ORACLE_HOME/dbs/initraclhr1.ora
echo "spfile='+DATA/raclhr/PARAMETERFILE/spfileraclhr.ora'" > $ORACLE_HOME/dbs/initraclhr2.ora
------------ 4、节点一启动到nomount状态
startup nomount
! ps -ef|grep raclhr
show parameter spfile
------------ 5、 创建DB
CREATE DATABASE raclhr
USER SYS IDENTIFIED BY lhr
USER SYSTEM IDENTIFIED BY lhr
CONTROLFILE REUSE
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
ARCHIVELOG
MAXLOGFILES 192 MAXLOGMEMBERS 5 MAXLOGHISTORY 292 MAXDATAFILES 1024 MAXINSTANCES 32
LOGFILE GROUP 1('+DATA','+DATA') SIZE 50M BLOCKSIZE 512,
GROUP 2('+DATA','+DATA') SIZE 50M blocksize 512,
GROUP 3('+DATA','+DATA') SIZE 50M BLOCKSIZE 512
DATAFILE '+DATA' SIZE 300M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 10G
SYSAUX DATAFILE '+DATA' SIZE 100M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 10G
SET DEFAULT bigfile TABLESPACE
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '+DATA' SIZE 10M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 1G
UNDO TABLESPACE UNDOTBS1 DATAFILE '+DATA'SIZE 10M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 1G
DEFAULT TABLESPACE USERS DATAFILE '+DATA' SIZE 10M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 10G
;
/* --------- BIGFILE
CREATE DATABASE raclhr
USER SYS IDENTIFIED BY lhr
USER SYSTEM IDENTIFIED BY lhr
CONTROLFILE REUSE
EXTENT MANAGEMENT LOCAL
SET DEFAULT bigfile TABLESPACE
DEFAULT TEMPORARY TABLESPACE TEMP
UNDO TABLESPACE UNDOTBS1
DEFAULT TABLESPACE USERS
;
*/
------------ 6、 修改rac需要的内容
create undo tablespace UNDOTBS2 datafile '+DATA' size 50M reuse autoextend off;
alter database add logfile thread 2 group 4 ('+DATA','+FRA') SIZE 50M BLOCKSIZE 512;
alter database add logfile thread 2 group 5 ('+DATA','+FRA') SIZE 50M BLOCKSIZE 512;
alter database add logfile thread 2 group 6 ('+DATA','+FRA') SIZE 50M BLOCKSIZE 512;
select * from v$log;
ALTER SYSTEM SET cluster_database=true scope=spfile sid='*';
ALTER SYSTEM SET instance_number=1 scope=spfile sid='raclhr1';
ALTER SYSTEM SET instance_number=2 scope=spfile sid='raclhr2';
ALTER SYSTEM SET thread=1 scope=spfile sid='raclhr1';
ALTER SYSTEM SET thread=2 scope=spfile sid='raclhr2';
ALTER SYSTEM SET undo_tablespace='UNDOTBS1' scope=spfile sid='raclhr1';
ALTER SYSTEM SET undo_tablespace='UNDOTBS2' scope=spfile sid='raclhr2';
alter database enable public thread 2;
shutdown immediate
------------ 7、 启动2个节点
------ rac 数据库添加到srvctl中
srvctl add database -d raclhr -c rac -o /oracle/app/oracle/product/11.2.0/db -p '+DATA/raclhr/PARAMETERFILE/spfileraclhr.ora' -r primary -n raclhr
srvctl config database -d raclhr -a
srvctl add instance -d raclhr -i raclhr1 -n ZFXDESKDB1
srvctl add instance -d raclhr -i raclhr2 -n ZFXDESKDB2
srvctl status database -d raclhr
srvctl stop db -d raclhr
srvctl start db -d raclhr
srvctl status database -d raclhr
crsctl stat res -t
------------ 8、 编译数据字典脚本
SPOOL /tmp/dictionary_tmp.sql
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/catclust.sql
@?/rdbms/admin/dbmspool.sql
@?/rdbms/admin/catblock.sql
@?/rdbms/admin/caths.sql
@?/rdbms/admin/owminst.plb
@?/sqlplus/admin/plustrce.sql
@?/rdbms/admin/utlrp.sql
@?/rdbms/admin/utlsampl.sql
conn system/lhr
@?/sqlplus/admin/pupbld.sql
@?/sqlplus/admin/help/hlpbld.sql helpus.sql
SPOOL off
------ drop database
alter system set cluster_database=false scope=spfile;
! srvctl stop db -d raclhr
startup force mount restrict;
drop database;
10G
export ORACLE_SID=lhrdb
orapwd file=$ORACLE_HOME/dbs/orapwlhrdb password=lhr force=y
vi $ORACLE_HOME/dbs/initlhrdb.ora
db_name=lhrdb
processes=150
max_dump_file_size=10240
global_names=TRUE
control_files=('/u01/app/oracle/oradata/lhrdb/control01.ora','/u01/app/oracle/oradata/lhrdb/control02.ora')
sga_target=400m
undo_management='AUTO'
undo_tablespace='UNDOTBS1'
mkdir -p $ORACLE_BASE/oradata/lhrdb
mkdir -p $ORACLE_BASE/lhrdb/adump
mkdir -p $ORACLE_BASE/lhrdb/bdump
mkdir -p $ORACLE_BASE/lhrdb/cdump
mkdir -p $ORACLE_BASE/lhrdb/ddump
mkdir -p $ORACLE_BASE/lhrdb/udump
sqlplus / as sysdba
create spfile from pfile;
startup nomount;
CREATE DATABASE lhrdb
USER SYS IDENTIFIED BY lhr
USER SYSTEM IDENTIFIED BY lhr
CONTROLFILE REUSE
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
ARCHIVELOG
MAXLOGFILES 24 MAXLOGMEMBERS 5 MAXLOGHISTORY 292 MAXDATAFILES 1024 MAXINSTANCES 12
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/lhrdb/redo01.log') SIZE 50M,
GROUP 2 ('/u01/app/oracle/oradata/lhrdb/redo02.log') SIZE 50M,
GROUP 3 ('/u01/app/oracle/oradata/lhrdb/redo03.log') SIZE 50M
DATAFILE '/u01/app/oracle/oradata/lhrdb/system01.dbf' SIZE 300M REUSE
SYSAUX DATAFILE '/u01/app/oracle/oradata/lhrdb/sysaux01.dbf' SIZE 100M REUSE
DEFAULT TEMPORARY TABLESPACE temp TEMPFILE '/u01/app/oracle/oradata/lhrdb/temp01.dbf' SIZE 20M REUSE
UNDO TABLESPACE undotbs1 DATAFILE '/u01/app/oracle/oradata/lhrdb/undotbs01.dbf' SIZE 10M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 1G ;
conn / as sysdba
SPOOL /tmp/dictionary_tmp.sql
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/catclust.sql
@?/rdbms/admin/dbmspool.sql
@?/rdbms/admin/catblock.sql
@?/rdbms/admin/caths.sql
@?/rdbms/admin/owminst.plb
@?/sqlplus/admin/plustrce.sql
@?/rdbms/admin/utlrp.sql
@?/rdbms/admin/utlsampl.sql
conn system/lhr
@?/sqlplus/admin/pupbld.sql
@?/sqlplus/admin/help/hlpbld.sql helpus.sql
SPOOL off
创建bigfile的db报错
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-01501: CREATE DATABASE failed
ORA-01519: error while processing file '?/rdbms/admin/dtxnspc.bsq' near line 20
ORA-00604: error occurred at recursive SQL level 1
ORA-32772: BIGFILE is invalid option for this type of tablespace
Process ID: 12451948
Session ID: 156 Serial number: 3
--------- 解决办法:SET DEFAULT bigfile TABLESPACE 位置不对,应该如下:
/* ---------BIGFILE
CREATE DATABASE lhrasm
USER SYS IDENTIFIED BY lhr
USER SYSTEM IDENTIFIED BY lhr
CONTROLFILE REUSE
CONTROLFILE REUSE
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
ARCHIVELOG
MAXLOGFILES 192 MAXLOGMEMBERS 5 MAXLOGHISTORY 292 MAXDATAFILES 1024 MAXINSTANCES 32
LOGFILE GROUP 1('+DATA','+DATA') SIZE 50M BLOCKSIZE 512,
GROUP 2('+DATA','+DATA') SIZE 50M blocksize 512,
GROUP 3('+DATA','+DATA') SIZE 50M BLOCKSIZE 512
DATAFILE '+DATA' SIZE 300M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
SYSAUX DATAFILE '+DATA' SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
SET DEFAULT bigfile TABLESPACE
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '+DATA' SIZE 20M REUSE AUTOEXTEND OFF
UNDO TABLESPACE UNDOTBS1 DATAFILE '+DATA'SIZE 50M REUSE AUTOEXTEND OFF
DEFAULT TABLESPACE USERS DATAFILE '+DATA' SIZE 500M REUSE AUTOEXTEND OFF
;
CREATE DATABASE lhrasm
USER SYS IDENTIFIED BY lhr
USER SYSTEM IDENTIFIED BY lhr
CONTROLFILE REUSE
EXTENT MANAGEMENT LOCAL
SET DEFAULT bigfile TABLESPACE
DEFAULT TEMPORARY TABLESPACE TEMP
UNDO TABLESPACE UNDOTBS1
DEFAULT TABLESPACE USERS
;
*/
手动建库中的组件安装
------ 安装JVM
@?/javavm/install/initjvm.sql;
@?/xdk/admin/initxml.sql;
@?/xdk/admin/xmlja.sql;
@?/rdbms/admin/catjava.sql;
-- 安装XMLDB
@?/rdbms/admin/catqm.sql oracle SYSAUX TEMP YES
@?/rdbms/admin/catxdbj.sql;
如何安装Sample Schemas
dbca静默安装中有个参数是sampleSchema我们若设置为true,则安装后数据库中有EXAMPLE表空间,有HR,OE,PM,SH,IX用户,大约占用350M的空间,若设置为false,则后续可以根据以下文档来安装。
手动建库中常用脚本的解释
Script Name
Needed For
Run By
Description
catalog.sql
All databases
SYS
Creates the data dictionary and public synonyms for many of its viewsGrants PUBLIC access to the synonyms
catproc.sql
All databases
SYS
Runs all scripts required for, or used with, PL/SQL
catclust.sql
Real Application Clusters
SYS
Creates Real Application Clusters data dictionary views
catblock.sql
Performance management
SYS
Creates views that can dynamically display lock dependency graphs
dbmspool.sql
Performance management
SYSor SYSDBA
Enables DBA to lock PL/SQL packages, SQL statements, and triggers into the shared pool
caths.sql
Heterogeneous Services
SYS
Installs packages for administering heterogeneous services
@?/rdbms/admin/owminst.plb
sys
创建WMSYS用户
@?/sqlplus/admin/pupbld.sql
system
解决PRODUCT_USER_PROFILE问题
@?/sqlplus/admin/plustrce.sql
sys
普通用户set autot on的权限
@?/sqlplus/admin/help/hlpbld.sql helpus.sql
system
sqlplus的帮助文档
关于sqlplus的帮助命令
手动建库最后有个脚本:@?/sqlplus/admin/help/hlpbld.sql helpus.sql是用来生成sqlpuls的帮助命令的,我们演示如下:
About Me
..........................................................................................................................................................................................................本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用
本文在ITpub(http://blog.itpub.net/26736162)和博客园(http://www.cnblogs.com/lhrbest)有同步更新
本文pdf版:http://yunpan.cn/cdEQedhCs2kFz (提取码:ed9b)
小麦苗分享的其它资料:http://blog.itpub.net/26736162/viewspace-1624453/
联系我请加QQ好友(642808185),注明添加缘由
于 2016-07-13 09:00~ 2016-07-13 17:00 在中行完成
【版权所有,文章允许转载,但须以链接方式注明源地址,否则追究法律责任】
..........................................................................................................................................................................................................
拿起手机扫描下边的图片来关注小麦苗的微信公众号:xiaomaimiaolhr,学习最实用的数据库技术。