ASM 手动建库

  

12月18日,继续asm 上装oracle 的过程:
先增加两块硬盘:

[root@aoracle ~]# fdisk -l

Disk /dev/sda: 19.3 GB, 19327352832 bytes
255 heads, 63 sectors/track, 2349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *         262        2349    16771860   83  Linux
/dev/sda2               1         261     2096451   82  Linux swap / Solaris

Partition table entries are not in disk order

Disk /dev/sdb: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1958    15727603+  83  Linux

Disk /dev/sdc: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        1305    10482381   83  Linux

Disk /dev/sdd: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdd doesn't contain a valid partition table

Disk /dev/sde: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sde doesn't contain a valid partition table

------------

下面把两块新加的盘格式化:

下面进行raw 的配置:

[root@aoracle dev]# cd /dev/raw
-bash: cd: /dev/raw: No such file or directory

下面:
cd /etc/udev

[root@aoracle rules.d]# pwd
/etc/udev/rules.d
[root@aoracle rules.d]# ls -l 60-raw*
-rw-r--r-- 1 root root 727 Dec 18 16:11 60-raw.rules

vi 60-raw.rules

add below lines:

ACTION=="add", KERNEL=="sdd1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="raw1",owner="oracle",group="oinstall",mode="660"
ACTION=="add", KERNEL=="sde1", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="raw2",owner="oracle",group="oinstall",mode="660"

-------

[root@aoracle rules.d]# start_udev
Starting udev: [  OK  ]
[root@aoracle rules.d]# cd /dev
[root@aoracle dev]# ls -l raw
total 0
crw-rw---- 1 oracle oinstall 162, 1 Dec 18 16:15 raw1
crw-rw---- 1 oracle oinstall 162, 2 Dec 18 16:15 raw2

[root@aoracle dev]# raw -qa
/dev/raw/raw1:  bound to major 8, minor 49
/dev/raw/raw2:  bound to major 8, minor 65

[oracle@aoracle dbs]$ vi init+EZHOU.ora

asm_diskstring=''
background_dump_dest=/u01/pp/oracle/admin/+EZHOU/bdump
user_dump_dest=/u01/pp/oracle/admin/+EZHOU/udump
core_dump_dest=/u01/pp/oracle/admin/+EZHOU/cdump
instance_type='asm'
~

export ORACLE_SID=+EZHOU
sqlplus / as sysdba

SQL> startup ;
ORA-29701: unable to connect to Cluster Manager
SQL

解决方法:

[root@aoracle bin]# ./localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
Startup will be queued to init within 90 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
        aoracle
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
[root@aoracle bin]# pwd
/u01/pp/oracle/product/10.2/db_1/bin

-------------

下面再startup:

[oracle@aoracle ~]$ sqlplus / as sysdba;

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 18 16:40:59 2011

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

Connected to an idle instance.

SQL> startup;
ASM instance started

Total System Global Area   79691776 bytes
Fixed Size                  1217812 bytes
Variable Size              53308140 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted

SQL> !ps -ef | grep ora_
oracle    8911  8862  0 16:41 pts/0    00:00:00 /bin/bash -c ps -ef | grep ora_

SQL> !ps -ef | grep asm
oracle    8866     1  0 16:41 ?        00:00:00 asm_pmon_+EZHOU
oracle    8868     1  0 16:41 ?        00:00:00 asm_psp0_+EZHOU
oracle    8870     1  0 16:41 ?        00:00:00 asm_mman_+EZHOU
oracle    8872     1  0 16:41 ?        00:00:00 asm_dbw0_+EZHOU
oracle    8874     1  0 16:41 ?        00:00:00 asm_lgwr_+EZHOU
oracle    8876     1  0 16:41 ?        00:00:00 asm_ckpt_+EZHOU
oracle    8878     1  0 16:41 ?        00:00:00 asm_smon_+EZHOU
oracle    8880     1  0 16:41 ?        00:00:00 asm_rbal_+EZHOU
oracle    8882     1  0 16:41 ?        00:00:00 asm_gmon_+EZHOU
oracle    8931  8862  0 16:42 pts/0    00:00:00 /bin/bash -c ps -ef | grep asm

---------

以上符合预期,我们来建asm diskgroup:

SQL> create diskgroup ezhouasm external redundancy disk '/dev/raw/raw1';

Diskgroup created.

SQL> alter diskgroup ezhouasm add disk '/dev/raw/raw2';

Diskgroup altered.

SQL> select name,state,total_mb,usable_file_mb from v$asm_diskgroup;

NAME                           STATE         TOTAL_MB USABLE_FILE_MB
------------------------------ ----------- ---------- --------------
EZHOUASM                       MOUNTED          10228          10176

-----

后来碰到asm 没有mount 的情况下:
export ORACLE_SID=+EZHOU
sqlpus / as sysdba

SQL> startup;
ASM instance started

Total System Global Area   79691776 bytes
Fixed Size                  1217812 bytes
Variable Size              53308140 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted

手工mount:
SQL> alter diskgroup ezhouasm mount;

Diskgroup altered.

下面开始手动建立数据库:

编写initezhouasm.ora

vi initezhouasm.ora

db_name=ezhouasm
db_files = 80                                                         # SMALL
db_file_multiblock_read_count = 8                                     # SMALL
log_checkpoint_interval = 10000
processes = 50                                                        # SMALL
parallel_max_servers = 5                                              # SMALL
max_dump_file_size = 10240      # limit trace file size to 5 Meg each
control_files = ('+ezhouasm/ezhouasm/controlfile/ezhouctl')
sga_target=300m
background_dump_dest=/u01/pp/oracle/admin/ezhouasm/bdump
core_dump_dest=/u01/pp/oracle/admin/ezhouasm/cdump
user_dump_dest=/u01/pp/oracle/admin/ezhouasm/udump
undo_management='auto'
undo_tablespace='ezhoutbs'

oracle@aoracle dbs]$ export ORACLE_SID=ezhouasm;

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  314572800 bytes
Fixed Size                  1219160 bytes
Variable Size              96470440 bytes
Database Buffers          213909504 bytes
Redo Buffers                2973696 bytes

-----------------------------------------------

下面编写create db 的脚本:
vi cdb.sql

create database ezhouasm
user sys identified by oracle
user system identified by manager
datafile '+ezhouasm/ezhouasm/datafile/system01.dbf' size 300m autoextend on next 30m extent management local sysaux datafile '+ezhouasm/ezhouasm/datafile/sysaux01.dbf' size 300m autoextend on next 30m
default temporary tablespace ezhou_temp tempfile '+ezhouasm/ezhouasm/tempfile/ezhou_temp01.dbf' size 100m
default tablespace ezhou datafile '+ezhouasm/ezhouasm/datafile/ezhou01.dbf' size 100m
undo tablespace ezhoutbs datafile '+ezhouasm/ezhouasm/datafile/ezhoutbs01.dbf' size 100m
logfile
group 1 ('+ezhouasm/ezhouasm/online_log/redo1_1.rdo') size 50m,
group 2 ('+ezhouasm/ezhouasm/online_log/redo2_1.rdo') size 50m,
group 3 ('+ezhouasm/ezhouasm/online_log/redo3_1.rdo') size 50m;


SQL> @cdb
create database ezhouasm
*
ERROR at line 1:
ORA-01501: CREATE DATABASE failed
ORA-00200: control file could not be created
ORA-00202: control file: '+EZHOUASM/ezhouasm/controlfile/ezhouctl'
ORA-17502: ksfdcre:4 Failed to create file
+EZHOUASM/ezhouasm/controlfile/ezhouctl
ORA-15001: diskgroup "EZHOUASM" does not exist or is not mounted
ORA-15077: could not locate ASM instance serving a required diskgroup

原来+EZHOU
diskgroup 没有mount
下面手工mount:

SQL> alter diskgroup ezhouasm mount;

Diskgroup altered.

好,下面继续建库:

SQL> @cdb
create database ezhouasm
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced

查找原因:
后来原因找到,是datafile重名,所以,要仔细。

重建成功:
看一下alter 日志:

create database ezhouasm
user sys identified by *user system identified by *datafile '+ezhouasm/ezhouasm/datafile/system01.dbf' size 300m autoextend on next 30m extent management local sysaux datafile '+ezhouasm/ezhouasm/datafile/sysaux01.dbf' size 300m autoextend on next 30m
default temporary tablespace ezhou_temp tempfile '+ezhouasm/ezhouasm/tempfile/ezhou_temp01.dbf' size 100m
default tablespace ezhou datafile '+ezhouasm/ezhouasm/datafile/ezhou01.dbf' size 100m
undo tablespace ezhoutbs datafile '+ezhouasm/ezhouasm/datafile/ezhoutbs01.dbf' size 100m
logfile
group 1 ('+ezhouasm/ezhouasm/online_log/redo1_1.rdo') size 50m,
group 2 ('+ezhouasm/ezhouasm/online_log/redo2_1.rdo') size 50m,
group 3 ('+ezhouasm/ezhouasm/online_log/redo3_1.rdo') size 50m
Mon Dec 19 11:09:43 2011
Starting background process ASMB
ASMB started with pid=13, OS id=6284
Starting background process RBAL
RBAL started with pid=14, OS id=6288
Mon Dec 19 11:09:47 2011
SUCCESS: diskgroup EZHOUASM was mounted
SUCCESS: diskgroup EZHOUASM was dismounted
Mon Dec 19 11:09:48 2011
SUCCESS: diskgroup EZHOUASM was mounted
Mon Dec 19 11:09:48 2011
Database mounted in Exclusive Mode
Mon Dec 19 11:10:00 2011
Successful mount of redo thread 1, with mount id 3742734263
Assigning activation ID 3742734263 (0xdf1597b7)
Thread 1 opened at log sequence 1
  Current log# 1 seq# 1 mem# 0: +EZHOUASM/ezhouasm/online_log/redo1_1.rdo
Successful open of redo thread 1
Mon Dec 19 11:10:00 2011
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Mon Dec 19 11:10:00 2011
SMON: enabling cache recovery
Mon Dec 19 11:10:00 2011
create tablespace SYSTEM datafile  '+ezhouasm/ezhouasm/datafile/system01.dbf' size 300m autoextend on next 30m
  EXTENT MANAGEMENT LOCAL online
Mon Dec 19 11:10:06 2011
Completed: create tablespace SYSTEM datafile  '+ezhouasm/ezhouasm/datafile/system01.dbf' size 300m autoextend on next 30m
  EXTENT MANAGEMENT LOCAL online
Mon Dec 19 11:10:06 2011
create rollback segment SYSTEM tablespace SYSTEM
  storage (initial 50K next 50K)
Completed: create rollback segment SYSTEM tablespace SYSTEM
  storage (initial 50K next 50K)
Mon Dec 19 11:10:26 2011
CREATE UNDO TABLESPACE EZHOUTBS DATAFILE  '+ezhouasm/ezhouasm/datafile/ezhoutbs01.dbf' size 100m

Mon Dec 19 11:10:33 2011
Successfully onlined Undo Tablespace 1.
Completed: CREATE UNDO TABLESPACE EZHOUTBS DATAFILE  '+ezhouasm/ezhouasm/datafile/ezhoutbs01.dbf' size 100m
Mon Dec 19 11:10:33 2011
create tablespace SYSAUX datafile  '+ezhouasm/ezhouasm/datafile/sysaux01.dbf' size 300m autoextend on next 30m

  EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO online
Mon Dec 19 11:10:50 2011
Completed: create tablespace SYSAUX datafile  '+ezhouasm/ezhouasm/datafile/sysaux01.dbf' size 300m autoextend on next 30m
  EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO online
Mon Dec 19 11:10:51 2011
CREATE TEMPORARY TABLESPACE EZHOU_TEMP TEMPFILE  '+ezhouasm/ezhouasm/tempfile/ezhou_temp01.dbf' size 100m

Completed: CREATE TEMPORARY TABLESPACE EZHOU_TEMP TEMPFILE  '+ezhouasm/ezhouasm/tempfile/ezhou_temp01.dbf' size 100m
Mon Dec 19 11:10:53 2011
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE EZHOU_TEMP
Completed: ALTER DATABASE DEFAULT TEMPORARY TABLESPACE EZHOU_TEMP
Mon Dec 19 11:10:53 2011
CREATE  TABLESPACE EZHOU DATAFILE  '+ezhouasm/ezhouasm/datafile/ezhou01.dbf' size 100m
 SEGMENT SPACE MANAGEMENT MANUAL
Completed: CREATE  TABLESPACE EZHOU DATAFILE  '+ezhouasm/ezhouasm/datafile/ezhou01.dbf' size 100m
 SEGMENT SPACE MANAGEMENT MANUAL
Mon Dec 19 11:10:55 2011
ALTER DATABASE DEFAULT TABLESPACE EZHOU
Completed: ALTER DATABASE DEFAULT TABLESPACE EZHOU
Mon Dec 19 11:11:04 2011
SMON: enabling tx recovery
Mon Dec 19 11:11:06 2011
Threshold validation cannot be done before catproc is loaded.
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Completed: create database ezhouasm
user sys identified by *user system identified by *datafile '+ezhouasm/ezhouasm/datafile/system01.dbf' size 300m autoextend on next 30m extent management local sysaux datafile '+ezhouasm/ezhouasm/datafile/sysaux01.dbf' size 300m autoextend on next 30m
default temporary tablespace ezhou_temp tempfile '+ezhouasm/ezhouasm/tempfile/ezhou_temp01.dbf' size 100m
default tablespace ezhou datafile '+ezhouasm/ezhouasm/datafile/ezhou01.dbf' size 100m
undo tablespace ezhoutbs datafile '+ezhouasm/ezhouasm/datafile/ezhoutbs01.dbf' size 100m
logfile
group 1 ('+ezhouasm/ezhouasm/online_log/redo1_1.rdo') size 50m,
group 2 ('+ezhouasm/ezhouasm/online_log/redo2_1.rdo') size 50m,
group 3 ('+ezhouasm/ezhouasm/online_log/redo3_1.rdo') size 50m
QMNC started with pid=17, OS id=6361

------------

db 创建成功;
SQL> startup nomount;
ORACLE instance started.

Total System Global Area  314572800 bytes
Fixed Size                  1219160 bytes
Variable Size              96470440 bytes
Database Buffers          213909504 bytes
Redo Buffers                2973696 bytes
SQL> @cdb

Database created.

SQL>

下面还要执行3个sql:
sql>@?/rdbms/admin/catalog

sql>@?/rdbms/admin/catproc

sql>conn system/manager
sql>@?/sqlplus/admin/pupbld


SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
+EZHOUASM/ezhouasm/datafile/system01.dbf
+EZHOUASM/ezhouasm/datafile/ezhoutbs01.dbf
+EZHOUASM/ezhouasm/datafile/sysaux01.dbf
+EZHOUASM/ezhouasm/datafile/ezhou01.dbf

4 rows selected.
SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+EZHOUASM/ezhouasm/controlfile/ezhouctl

1 row selected.

SQL> select name from v$tempfile;

NAME
--------------------------------------------------------------------------------
+EZHOUASM/ezhouasm/tempfile/ezhou_temp01.dbf

1 row selected.

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
+EZHOUASM/ezhouasm/online_log/redo1_1.rdo
+EZHOUASM/ezhouasm/online_log/redo2_1.rdo
+EZHOUASM/ezhouasm/online_log/redo3_1.rdo

3 rows selected.

SQL>

好,数据库建立完毕。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

shenghuiping2001

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值