1 、确定数据库的sid 和db_name
sid='hsj'
db_name='hsj'
2、设置环境变量env
ORACLE_BASE=/u01/appORACLE_HOME=$ORACLE_BASE/oracleORACLE_SID=hsjPATH=$ORACLE_HOEM/bin:$PATH;LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATHexport ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH
3、设置登录方法,使用操作系统登录还是远程登录
使用本地操作系统用户,具有dba权限的oracle用户
sqlplus /nolog
conn as sysdba;
4、创建一个使用的pfile文件
vi inithsj.orahsj.__db_cache_size=385875968hsj.__java_pool_size=4194304hsj.__large_pool_size=4194304hsj.__shared_pool_size=163577856hsj.__streams_pool_size=0audit_file_dest='/u01/app/admin/hsj/adump'background_dump_dest='/u01/app/admin/hsj/bdump'compatible='10.2.0.1.0'control_files='/u01/app/oradata/hsj/control01.ctl','/u01/app/oradata/hsj/control02.ctl','/u01/app/oradata/hsj/control03.ctl'core_dump_dest='/u01/app/admin/hsj/cdump'db_block_size=8192db_domain=''db_file_multiblock_read_count=16db_name='hsj'db_recovery_file_dest='/u01/app/flash_recovery_area'db_recovery_file_dest_size=2147483648dispatchers='(PROTOCOL=TCP) (SERVICE=hsjXDB)'job_queue_processes=10log_archive_format='%t_%s_%r.dbf'open_cursors=300pga_aggregate_target=187695104processes=150remote_login_passwordfile='EXCLUSIVE'sga_target=563085312undo_management='AUTO'undo_tablespace='UNDOTBS1'user_dump_dest='/u01/app/admin/hsj/udump'
5、根据pfile文件创建想对应的目录
需要在$ORACLE_BASE/admin 下创建一个目录 hsj及其相关的子目录
$ORACLE_BASE/oradate 下面增加一个目录 hsj 及其子目录 archivelog
6、根据pfile文件创建spfile
startup nomount;
create spfile from pfile;
shutdown immediate;
7、在$ORACLE_HOME/dbs/ 下创建 orapwhsj
orapwd file=orapwhsj password=root entries=5
8、使用spfile启动数据库到nomount状态
startup up nomount
9、使用脚本创建数据库
spool db.log;CREATE DATABASE "hsj"USER SYS IDENTIFIED BY rootUSER SYSTEM IDENTIFIED BY rootMAXDATAFILES 500MAXINSTANCES 8MAXLOGFILES 32CHARACTER SET "UTF8"NATIONAL CHARACTER SET AL16UTF16ARCHIVELOGDATAFILE '/u01/app/oradata/hsj/system01.dbf' size 300MEXTENT MANAGEMENT LOCALSYSAUX DATAFILE '/u01/app/oradata/hsj/sysaux01.dbf' SIZE 325M REUSEDEFAULT TEMPORARY TABLESPACE temp TEMPFILE '/u01/app/oradata/hsj/tempts01.dbf' SIZE 100MEXTENT MANAGEMENT LOCALUNDO TABLESPACE "UNDOTBS1"DATAFILE '/u01/app/oradata/hsj/undotbs01.dbf' SIZE 200MLOGFILEGROUP 1 ('/u01/app/oradata/hsj/redo01a.rdo','/u01/app/oradata/hsj/redo01b.rdo') SIZE 100M,GROUP 2 ('/u01/app/oradata/hsj/redo02a.rdo','/u01/app/oradata/hsj/redo02b.rdo') SIZE 100M,GROUP 3 ('/u01/app/oradata/hsj/redo03a.rdo','/u01/app/oradata/hsj/redo03b.rdo') SIZE 100M;spool off;
10 运行脚本创建数据字典
@ORACLE_HOME/admin/catalog.sql(@/u01/app/oracle/admin/catalog.sql)
@ORACLE_HOME/admin/catproc.sql(@/u01/app/oracle/admin/catproc.sql)
11 启动数据库
startup
12 备份数据库
backup database
posted on 2013-08-16 11:09 顺其自然EVO 阅读(708) 评论(0) 编辑 收藏 所属分类: 数据库