您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
三六零分类信息网 > 潍坊分类信息网,免费分类信息发布

Oracle手工建库指南

2025/4/1 12:56:40发布9次查看
一:设置环境变量 [oracle@orcl ~]$ cat .bash_profile # .bash_profile # get the aliases and functionsif [ -f ~/.bashrc ];
一:设置环境变量
[oracle@orcl ~]$ cat .bash_profile
# .bash_profile
# get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# user specific environment and startup programs
oracle_sid=orcl
oracle_base=/u01/app/oracle
oracle_home=$oracle_base/product/10.2.0/db_1
editor=vim
nls_lang=american_america.al32utf8
nls_date_format=yyyy-mm-dd:hh24:mi:ss
path=$path:$home/bin:$oracle_home/bin:$path
export path oracle_sid oracle_base oracle_home editor nls_lang nls_date_format
alias sqlplus='/usr/local/rlwrap/bin/rlwrap sqlplus'
alias rman='/usr/local/rlwrap/bin/rlwrap rman'
二:准备密码文件和初始化参数文件以及创建数据库脚本
 [root@orcl ~]# su - oracle
[oracle@orcl ~]$ cd $oracle_home/dbs
[oracle@orcl dbs]$ orapwd file=orapworcl password=123456 entries=5
*.db_name=orcl
*.db_block_size=8192
*.sga_target=1677721600
*.undo_management='auto'
*.control_files = ('/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control012ctl','/u01/app/oracle/oradata/orcl/control03.ctl')
*.user_dump_dest='/u01/app/oracle/admin/orcl/udump'
*.background_dump_dest='/u01/app/oracle/admin/orcl/bdump'
*.core_dump_dest='/u01/app/oracle/admin/orcl/cdump'
[oracle@orcl ~]$ cat $oracle_home/dbs/initorcl.ora
*.db_name=orcl
*.db_block_size=8192
*.db_file_multiblock_read_count=16
*.db_unique_name='orcl'
*.sga_target=167772160
*.undo_management='auto'
*.undo_tablespace='undotbs1'
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=1500
*.control_files = ('/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control012ctl','/u01/app/oracle/oradata/orcl/control03.ctl')
*.user_dump_dest='/u01/app/oracle/admin/orcl/udump'
*.background_dump_dest='/u01/app/oracle/admin/orcl/bdump'
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.core_dump_dest='/u01/app/oracle/admin/orcl/cdump'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
[oracle@orcl ~]$ cat create_db.sql
create database orcl
      user sys identified by 123456
      user system identified by 123456
      logfile
      group 1 ('/u01/app/oracle/oradata/orcl/redo01_1.dbf','/u01/app/oracle/oradata/orcl/redo01_2.dbf') size 150m,
      group 2 ('/u01/app/oracle/oradata/orcl/redo02_1.dbf','/u01/app/oracle/oradata/orcl/redo02_2.dbf') size 150m,
      group 3 ('/u01/app/oracle/oradata/orcl/redo03_1.dbf','/u01/app/oracle/oradata/orcl/redo03_2.dbf') size 150m
      maxlogfiles 10
      maxlogmembers 5
      maxloghistory 1
      maxdatafiles 100
      maxinstances 1
      character set al32utf8
      national character set al16utf16
      datafile '/u01/app/oracle/oradata/orcl/system01.dbf' size 2000m reuse extent management local
      sysaux datafile '/u01/app/oracle/oradata/orcl/sysaux01.dbf' size 800m reuse
      default temporary tablespace temp tempfile '/u01/app/oracle/oradata/orcl/temp01.dbf' size 20m reuse
      undo tablespace undotbs1 datafile '/u01/app/oracle/oradata/orcl/undotbs1.dbf' size 2000m reuse autoextend on next 5120k maxsize unlimited;
三:准备创建数据库需要的相关目录 
 [oracle@orcl ~]$ mkdir -p /u01/app/oracle/admin/orcl
[oracle@orcl ~]$ mkdir -p /u01/app/oracle/oradata/orcl
[oracle@orcl ~]$ mkdir -p /u01/app/oracle/admin/orcl/{adump,bdump,cdump,udump}
[oracle@orcl ~]$ mkdir -p /u01/app/oracle/flash_recovery_area 
四:开始建库
 [oracle@orcl ~]$ env |grep sid
oracle_sid=orcl
[oracle@orcl ~]$ sqlplus /nolog
sql*plus: release 10.2.0.1.0 - production on thu sep 29 11:55:01 2011
copyright (c) 1982, 2005, oracle.  all rights reserved.
sql> conn /as sysdba
connected to an idle instance.
sql> create spfile from pfile;
file created.
sql> startup nomount
oracle instance started.
total system global area  167772160 bytes
fixed size                  1218316 bytes
variable size             121637108 bytes
database buffers           41943040 bytes
redo buffers                2973696 bytes
sql> @/home/oracle/create_db.sql;
database created
[oracle@orcl ~]$ ls -lh /u01/app/oracle/oradata/orcl/
total 5.6g
-rw-r----- 1 oracle oinstall 6.6m sep 29 14:30 control012ctl
-rw-r----- 1 oracle oinstall 6.6m sep 29 14:30 control01.ctl
-rw-r----- 1 oracle oinstall 6.6m sep 29 14:30 control03.ctl
-rw-r----- 1 oracle oinstall 151m sep 29 14:25 redo01_1.dbf
-rw-r----- 1 oracle oinstall 151m sep 29 14:25 redo01_2.dbf
-rw-r----- 1 oracle oinstall 151m sep 29 14:22 redo02_1.dbf
-rw-r----- 1 oracle oinstall 151m sep 29 14:22 redo02_2.dbf
-rw-r----- 1 oracle oinstall 151m sep 29 14:22 redo03_1.dbf
-rw-r----- 1 oracle oinstall 151m sep 29 14:22 redo03_2.dbf
-rw-r----- 1 oracle oinstall 801m sep 29 14:25 sysaux01.dbf
-rw-r----- 1 oracle oinstall 2.0g sep 29 14:25 system01.dbf
-rw-r----- 1 oracle oinstall  21m sep 29 14:25 temp01.dbf
-rw-r----- 1 oracle oinstall 2.0g sep 29 14:25 undotbs1.dbf
sql> @$oracle_home/rdbms/admin/catalog.sql;
pl/sql procedure successfully completed.
sql> @$oracle_home/rdbms/admin/catproc.sql;
pl/sql procedure successfully completed.
sql> shutdown immediate
sql> startup
oracle instance started.
total system global area  167772160 bytes
fixed size                  1218316 bytes
variable size             138414324 bytes
database buffers           25165824 bytes
redo buffers                2973696 bytes
database mounted.
database opened.
五:验证
[oracle@orcl ~]$ rman target /
recovery manager: release 10.2.0.1.0 - production on thu sep 29 14:52:27 2011
copyright (c) 1982, 2005, oracle.  all rights reserved.
connected to target database: orcl (dbid=1290917246)
rman> list incarnation;
using target database control file instead of recovery catalog
list of database incarnations
db key  inc key db name  db id            status  reset scn  reset time
------- ------- -------- ---------------- --- ---------- ----------
1       1       orcl     1290917246       current 1          2011-09-29:14:21:50
rman> report schema;
report of database schema
list of permanent datafiles
===========================
file size(mb) tablespace           rb segs datafile name
---- -------- -------------------- ------- ------------------------
1    2000     system               ***     /u01/app/oracle/oradata/orcl/system01.dbf
2    2000     undotbs1             ***     /u01/app/oracle/oradata/orcl/undotbs1.dbf
3    800      sysaux               ***     /u01/app/oracle/oradata/orcl/sysaux01.dbf
list of temporary files
=======================
file size(mb) tablespace           maxsize(mb) tempfile name
---- -------- -------------------- ----------- --------------------
1    20       temp                 20          /u01/app/oracle/oradata/orcl/temp01.dbf
sql> create tablespace users datafile '/u01/app/oracle/oradata/orcl/users01.dbf' size 500m
  2  autoextend on maxsize 5g;
tablespace created
sql> alter database default tablespace users;
database altered
六:配置em
 建立和配置em资料库
sql> @?/sysman/admin/emdrep/sql/emreposcre /u01/app/oracle/product/10.2.0/db_1 sysman 123456 temp on;
sql> alter user sysman identified by 123456 account unlock;
sql> alter user dbsnmp identified by 123456 account unlock;
sql> exit
[oracle@orcl admin]$ emca -config dbcontrol db -silent -db_unique_name orcl -port 1521 -em_home /u01/app/oracle/product/10.2.0/db_1 -listener listener -service_name orcl.herostart.com -sys_pwd 123456 -sid orcl -oracle_home /u01/app/oracle/product/10.2.0/db_1 -dbsnmp_pwd 123456 -host orcl.herostart.com -listener_oh /u01/app/oracle/product/10.2.0/db_1 -log_file /u01/app/oracle/product/10.2.0/db_1/log/emconfig.log -sysman_pwd 123456
[oracle@orcl admin]$ emctl status dbconsole
tz set to prc
oracle enterprise manager 10g database control release 10.2.0.1.0 
copyright (c) 1996, 2005 oracle corporation.  all rights reserved.
:1158/em/console/aboutapplication
oracle enterprise manager 10g is running.
------------------------------------------------------------------
logs are generated in directory /u01/app/oracle/product/10.2.0/db_1/orcl.herostart.com_orcl/sysman/log

潍坊分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录