189 8069 5689

linux下oracle手工建库过程

1、创建目录
$ORACLE_BASE/admin/
$ORACLE_BASE/oradata
$ORACLE_BASE/flash_recovery_area

创新互联于2013年成立,先为调兵山等服务建站,调兵山等地企业,进行企业商务咨询服务。为调兵山企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。


2、建初始化参数文件

cd   $ORACLE_HOME/dbs
db_name=orcl
memory_target=1G
processes = 150
audit_file_dest='/oracle/app/product/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/oracle/app/product/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/oracle/app/product'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = (/oracle/app/product/oradata/ora_control1,/oracle/app/product/oradata/ora_control2,/oracle/app/product/oradata/ora_control3)
compatible ='11.2.0'
undo_management=AUTO


3、创建密码文件
orapwd file=$ORACLE_HOME/dbs/orapworcl password=oracle force=y


4、建库

a、创建spfile

$ sqlplus '/as sysdba'

SQL> create spfile from pfile; (会自动读取pfile:$ORACLE_HOME/dbs/init$ORACLE_SID.ora)

b、启动到nomount状态创数据库------期间自动创建控制文件
SQL> startup nomount;
SQL> @/home/oracle/createdb.sql-------------------创建数据库

创看脚本
create database orcl CONTROLFILE REUSE
MAXINSTANCES 8 MAXDATAFILES 2000
MAXLOGHISTORY 2 MAXLOGFILES 64 MAXLOGMEMBERS 5
character set ZHS16GBK national character set AL16UTF16
logfile group 1 ('/oracle/app/product/oradata/orcl/redo1.log') size 50M reuse,
group 2 ('/oracle/app/product/oradata/orcl/redo2.log') size 50M reuse,
group 3 ('/oracle/app/product/oradata/orcl/redo3.log') size 50M reuse
datafile '/oracle/app/product/oradata/orcl/system.dbf' size 1024M reuse autoextend on next 100M maxsize unlimited extent management local
sysaux datafile '/oracle/app/product/oradata/orcl/sysaux.dbf' size 1024M autoextend on next 100M maxsize unlimited
default temporary tablespace temp tempfile '/oracle/app/product/oradata/orcl/temp01.dbf' size 100M reuse autoextend on next 10M maxsize unlimited
undo tablespace undotbs1 datafile '/oracle/app/product/oradata/orcl/undotbs1.dbf' size 100M reuse autoextend on next 10M maxsize unlimited
USER SYS IDENTIFIED BY "oracle" USER SYSTEM IDENTIFIED BY "oracle";


c、运行数据字典脚本,其中catalog和catproc是必需的,其它可选: (运行时间比较长)

SQL> spool /opt/oradata/cat_testdb.log

SQL> @?/rdbms/admin/catalog.sql----------------(建数据字典视图)-----------------------必须

SQL> @?/rdbms/admin/catproc.sql-----------(建存储过程包)-----------------------------------必须

SQL> @?/rdbms/admin/catblock.sql -----------(建锁相关的几个视图)

SQL> @?/rdbms/admin/catoctk.sql ----------(建密码工具包dbms_crypto_toolkit)

SQL> @?/rdbms/admin/owminst.plb---------------(建工作空间管理相关对象,如dmbs_wm)

SQL> spool off


d、 新建sqlplus属性和帮助、USERS表空间
SQL> connect system/oracle

SQL> @?/sqlplus/admin/pupbld.sql

SQL> @?/sqlplus/admin/help/hlpbld.sql helpus.sql

SQL> connect /as sysdba

SQL> CREATE TABLESPACE USERS LOGGING DATAFILE '/oracle/app/product/oradata/orcl/users01.dbf' SIZE 1024M REUSE AUTOEXTEND ON NEXT 100m MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

SQL> ALTER DATABASE DEFAULT TABLESPACE USERS;


SQL> execute utl_recomp.recomp_serial();


配置网络listener  sqlnet.ora  tnsname.ora


建立和配置EM(省略此步骤):

SQL> @?/sysman/admin/emdrep/sql/emreposcre /oracle/product/10.2 SYSMAN oracle TEMP ON;

SQL> alter user SYSMAN identified by "sysman" account unlock;

SQL> alter user DBSNMP identified by "dbsnmp" account unlock;

SQL> host emca -config dbcontrol db -silent -DB_UNIQUE_NAME ypyhtb -PORT 1521 -EM_HOME /oracle/product/10.2/bin -LISTENER LISTENER -SERVICE_NAME ypythb.LK -SYS_PWD "oracle" -SID ypythb -ORACLE_HOME /oracle/product/10.2 -DBSNMP_PWD "dbsnmp" -HOST "172.19.201.184" -LISTENER_OH /oracle/product/10.2 -LOG_FILE /oradata/ypythb/emConfig.log -SYSMAN_PWD "sysman";


网页名称:linux下oracle手工建库过程
文章路径:http://cdxtjz.cn/article/ghooce.html

其他资讯