Chinaunix首页 | 论坛 | 博客
  • 博客访问: 90027
  • 博文数量: 30
  • 博客积分: 1501
  • 博客等级: 上尉
  • 技术积分: 300
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-01 09:23
文章分类

全部博文(30)

文章存档

2011年(6)

2010年(24)

分类: Oracle

2010-11-24 18:51:58

1.创建数据目录
[root@xinchang ~]# su - root
[root@xinchang ~]# mkdir -p /home/oracle/oradata/db10
[root@xinchang ~]# chown -R oracle:dba /home/oracle/oradata/db10/
2.创建归档目录
[root@xinchang ~]# mkdir -p /home/oracle/archive/db10
[root@xinchang ~]# chown -R oracle:dba /home/oracle/archive/db10/
3.创建dump和pfile目录
[root@xinchang ~]# su - oracle
[oracle@xinchang ~]$ mkdir -p /home/oracle/admin/db10/adump
[oracle@xinchang ~]$ mkdir -p /home/oracle/admin/db10/bdump
[oracle@xinchang ~]$ mkdir -p /home/oracle/admin/db10/cdump
[oracle@xinchang ~]$ mkdir -p /home/oracle/admin/db10/udump
[oracle@xinchang ~]$ mkdir -p /home/oracle/admin/db10/pfile
4.创建口令文件
[oracle@xinchang ~]$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=hello123 entries=30
5.创建初始化参数文件
vim /home/oracle/admin/db10/pfile/init.ora
#*.archive_lag_target=600

*.background_dump_dest='/home/oracle/admin/db10/bdump'

*.compatible='10.2.0.1.0'

*.control_files='/home/oracle/oradata/db10/control01.ctl','/home/oracle/oradata/db10/control02.ctl','/home/oracle/oradata/db10/control03.ctl'

*.core_dump_dest='/home/oracle/admin/db10/cdump'

*.db_block_size=8192

*.db_cache_size=698351616

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='taobao'

*.fast_start_mttr_target=300

*.hs_autoregister=FALSE

*.instance_name='simon'

*.java_pool_size=1048576

*.job_queue_processes=8

*.large_pool_size=1048576

#*.lock_sga=true

*.log_archive_dest_1='location=/home/oracle/archive/db10'

*.log_archive_format='%t_%s_%r.arc'

*.log_archive_max_processes=3

#*.open_cursors=500

#*.optimizer_index_caching=80

#*.optimizer_index_cost_adj=40

*.pga_aggregate_target=33554432

*.processes=150

#*.query_rewrite_enabled='FALSE'

*.remote_login_passwordfile='EXCLUSIVE'

#*.session_cached_cursors=200

*.shared_pool_size=314572800

*.sort_area_size=32768

#*.standby_file_management='AUTO'

*.star_transformation_enabled='FALSE'

*.timed_statistics=TRUE

*.undo_management='AUTO'

*.undo_retention=7200

*.undo_tablespace='UNDO'

*.user_dump_dest='/home/oracle/admin/db10/udump'
保存并退出
注:这里的很多内存size参数是要根据实际内存容量来进行设置的~!单位是Byte~~~!!
[oracle@xinchang pfile]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Nov 24 16:12:53 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount pfile=/home/oracle/admin/db10/pfile/init.ora
ORACLE instance started.

Total System Global Area 1027604480 bytes
Fixed Size            1223248 bytes
Variable Size          322962864 bytes
Database Buffers      700448768 bytes
Redo Buffers            2969600 bytes
SQL>
出现如上提示代表参数文件设置成功~!
6.创建数据库
[oracle@xinchang ~]$ touch create.sql
[oracle@xinchang ~]$ chmod a+x create.sql
[oracle@xinchang ~]$ vim create.sql
CREATE DATABASE taobao CONTROLFILE REUSE
MAXINSTANCES 8
MAXLOGHISTORY 100
MAXLOGFILES 18
MAXLOGMEMBERS 3
MAXDATAFILES 1023
DATAFILE '/home/oracle/oradata/db10/system_01.dbf' SIZE 256M REUSE
AUTOEXTEND OFF
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/home/oracle/oradata/db10/sysaux_01.dbf' SIZE 128M REUSE
AUTOEXTEND OFF
DEFAULT TEMPORARY TABLESPACE TEMP
TEMPFILE '/home/oracle/oradata/db10/temp_01.dbf' SIZE 128M REUSE
AUTOEXTEND OFF
UNDO TABLESPACE UNDO
DATAFILE '/home/oracle/oradata/db10/undo_01.dbf' SIZE 128M REUSE
AUTOEXTEND OFF
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('/home/oracle/oradata/db10/redo01_01.log',
 '/home/oracle/oradata/db10/redo01_02.log') SIZE 50M REUSE,
GROUP 2 ('/home/oracle/oradata/db10/redo02_01.log',
 '/home/oracle/oradata/db10/redo02_02.log') SIZE 50M REUSE,
GROUP 3 ('/home/oracle/oradata/db10/redo03_01.log',
 '/home/oracle/oradata/db10/redo03_02.log') SIZE 50M REUSE;
保存退出
注意:这里的所有目录必须与你所建目录匹配否则会报错
[oracle@xinchang ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Nov 24 16:20:14 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> @/home/oracle/create.sql

Database created.

看到这个提示表明脚本运行没有问题,数据库成功创建~!
7.创建数据字典
[oracle@xinchang ~]$ touch data.sql
[oracle@xinchang ~]$ chmod a+x data.sql
[oracle@xinchang ~]$ vim data.sql
set termout off
set echo on
spool createdb.log
@?/rdbms/admin/catalog.sql;
@?/rdbms/admin/catproc.sql;
@?/rdbms/admin/catblock.sql;
@?/rdbms/admin/catoctk.sql;
#SQL>connect system/hello123
#@?/sqlplus/admin/pupbld.sql
spool off
保存并退出
[oracle@xinchang ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Nov 24 17:23:23 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> @/home/oracle/data.sql
注意这里耗时比较长~!
8.修改SYSTEM用户口令
SQL> alter user system identified by hello123;

User altered.
9.创建spfile
SQL> create spfile from pfile='/home/oracle/admin/db10/pfile/init.ora';

File created.
10.调整初始化参数
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1027604480 bytes
Fixed Size            1223248 bytes
Variable Size          322962864 bytes
Database Buffers      700448768 bytes
Redo Buffers            2969600 bytes
Database mounted.
Database opened.
SQL> alter system set xxx=xxx scope=spfile;
其中xxx=xxx是你要修改的参数及其参数值
SQL> create pfile='/home/oracle/admin/db10/pfile/init.ora' from spfile;
这里是修改完成后同步pfile
11.启用归档模式
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 1027604480 bytes
Fixed Size            1223248 bytes
Variable Size          322962864 bytes
Database Buffers      700448768 bytes
Redo Buffers            2969600 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.
supplement logging 设置
SQL> select supplemental_log_data_min as supp_log, supplemental_log_data_pk as supp_pk,supplemental_log_data_ui as supp_ui from v$database;

SUPP_LOG SUP SUP
-------- --- ---
NO     NO  NO
如果是如上所示都是NO的话执行一下语句:
SQL> alter database add supplemental log data (primary key,unique index) columns;

Database altered.
12.配置启动监听
[oracle@xinchang admin]$ vim listener.ora
 LISTENER =
 (DESCRIPTION_LIST=
   (DESCRIPTION=
     (ADDRESS_LIST=
        (ADDRESS=(PROTOCOL=tcp)(HOST=10.13.43.45)(PORT=1521))
     )
   )
 )
 SID_LIST_LISTENER=
   (SID_LIST=
        (SID_DESC=
          (GLOBAL_DBNAME=taobao)
          (SID_NAME=simon)
          (ORACLE_HOME=/home/oracle/product/10.2)
         )
     )
ADMIN_RESTRICTIONS_listener=ON
保存退出
注意:在/home/oracle/product/10.2/network/admin/samples目录下由模板。
[oracle@xinchang admin]$ lsnrctl start listener

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 24-NOV-2010 18:47:46

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Starting /home/oracle/product/10.2//bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /home/oracle/product/10.2/network/admin/listener.ora
Log messages written to /home/oracle/product/10.2/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xinchang.taobao.com)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     listener
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                24-NOV-2010 18:47:46
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /home/oracle/product/10.2/network/admin/listener.ora
Listener Log File         /home/oracle/product/10.2/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xinchang.taobao.com)(PORT=1521)))
The listener supports no services
The command completed successfully

阅读(624) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-11-25 11:56:15

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com