oracle命令如何创建数据库

这篇文章主要介绍oracle命令如何创建数据库,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

创新互联建站专注于网站建设|网站维护|优化|托管以及网络推广,积累了大量的网站设计与制作经验,为许多企业提供了网站定制设计服务,案例作品覆盖成都石牌坊等行业。能根据企业所处的行业与销售的产品,结合品牌形象的塑造,量身建设品质网站。

oracle命令(手工)创建数据库
有时由于没有图形界面,需要调动命令,查询网上各资料,汇总之后,编写了自己一次的命令创建数据库的经历。

1 添加环境变量
export PATH
export ORACLE_BASE=/u01
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0.4/db_1
export ORACLE_SID=dbtest
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/lib64:$LD_LIBRARY_PATH
umask 022
unset USERNAME


2 系统规划 db_name=dbtest oracle_sid=dbtest
3 手工创建目录
mkdir -p /u01/app/oracle/admin/dbtest/adump
mkdir -p /u01/app/oracle/admin/dbtest/bdump
mkdir -p /u01/app/oracle/admin/dbtest/cdump
mkdir -p /u01/app/oracle/admin/dbtest/udump




4建立密码文件:
orapwd file=/u01/product/10.2.0.4/db_1/dbs/orapwdbtest password=123456
5---修改参数文件:


*.audit_file_dest='/u01/admin/dbtest/adump'
*.background_dump_dest='/u01/admin/dbtest/bdump'
*.compatible='10.2.0.3.0'
*.control_files='/u01/oradata/dbtest/control01.ctl','/u01/oradata/dbtest/control02.ctl','/u01/oradata/dbtest/control03.ctl'
*.core_dump_dest='/u01/admin/dbtest/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='dbtest'
*.db_recovery_file_dest='/u01/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.job_queue_processes=10
*.log_archive_dest_1='location=/u01/arch'
*.log_archive_dest_2=''
*.open_cursors=300
*.pga_aggregate_target=545489408
*.processes=1500
*.recyclebin='OFF'
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1210612736
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/admin/dbtest/udump'






---------------------------------------------------
可将此文件复制到:
6--- 登陆oracle:
> sqlplus / as sysdba
7--- 启动实例:
SQL> startup nomount pfile=/u01/product/10.2.0.4/db_1/dbs/initdbtest.ora
8--- 创建数据库的脚本:
-----------------------------------------------------------
CREATE DATABASE dbtest
LOGFILE
GROUP 1 ('/u01/oradata/dbtest/redo01.log','/u01/oradata/dbtest/redo01_1.log') size 500m reuse,
GROUP 2 ('/u01/oradata/dbtest/redo02.log','/u01/oradata/dbtest/redo02_1.log') size 500m reuse,
GROUP 3 ('/u01/oradata/dbtest/redo03.log','/u01/oradata/dbtest/redo03_1.log') size 500m reuse
MAXLOGFILES 50
MAXLOGMEMBERS 5
MAXLOGHISTORY 200
MAXDATAFILES 500
MAXINSTANCES 5
ARCHIVELOG
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
DATAFILE '/u01/oradata/dbtest/system01.dbf' SIZE 1000M EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/oradata/dbtest/sysaux01.dbf' SIZE 1000M
UNDO TABLESPACE UNDOTBS1 DATAFILE '/u01/oradata/dbtest/UNDOTBS1.dbf' SIZE 500M
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/oradata/dbtest/temp01.dbf' SIZE 500M;




-----------------------------------------------------------
9--- 运行如下文件(安照下面的先后顺序):
sql>@$ORACLE_HOME/rdbms/admin/catalog.sql
sql>@$ORACLE_HOME/rdbms/admin/catproc.sql
sql>conn system/manager
sql>@$ORACLE_HOME/sqlplus/admin/pupbld.sql
10--- 创建相关表空间与用户:
create tablespace testnew datafile '/u01/oradata/dbtest/testnew01.dbf' size 2g;
create user testnew identified by testnew default tablespace testnew;
grant connect,resource to testnew;

以上是“oracle命令如何创建数据库”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


文章题目:oracle命令如何创建数据库
网址分享:http://pwwzsj.com/article/jogjec.html