从文件系统迁移至ASM实战 注意:(这里就不解释每一行的意思了,这篇是给有点基础的人看的)
-------------------------------------------从文件系统迁移至ASM实战---------------------------------------------------------
[root@station bin]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 268 2048287+ 82 Linux swap / Solaris
/dev/sda3 269 2610 18812115 8e Linux LVM
Disk /dev/sdb: 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/sdb1 1 1305 10482381 5 Extended
/dev/sdb5 1 123 987934+ 8e Linux LVM
/dev/sdb6 124 246 987966 8e Linux LVM
/dev/sdb7 247 369 987966 8e Linux LVM
/dev/sdb8 370 492 987966 8e Linux LVM
/dev/sdb9 493 979 3911796 8e Linux LVM
[root@station bin]# cat /etc/sysconfig/rawdevices
# raw device bindings
# format: <rawdev> <major> <minor>
# <rawdev> <blockdev>
# example: /dev/raw/raw1 /dev/sda1
/dev/raw/raw1 /dev/sdb5
/dev/raw/raw2 /dev/sdb6
/dev/raw/raw3 /dev/sdb7
/dev/raw/raw4 /dev/sdb8
/dev/raw/raw5 /dev/sdb9
[root@station bin]# cat /etc/rc.d/init.d/rawdevices
# See how we were called.
case "$1" in
start)
# Assign devices
echo $"Assigning devices: "
assign_raw
sleep 3
chown -R oracle:oinstall /dev/raw/
echo $"done"
;;
chkconfig rawdevices on
service rawdevices start
raw -qa
[root@station ~]# cd /u01/app/oracle/product/10.2.0/db_1/bin/
[root@station 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.
station
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
Red Hat Enterprise Linux 6 64-bit (这里要手工加入)
vim /etc/inittab
x:5:respawn:/u01/app/oracle/product/10.2.0/db_1/bin/localconfig reset &
h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null&
[root@station bin]# ps aux|grep css
root 4285 0.0 0.1 45940 1248 ? S<s 21:35 0:00 /bin/su -l oracle -c sh -c 'cd /u01/app/oracle/product/10.2.0/db_1/log/station/cssd; ulimit -c unlimited; exec /u01/app/oracle/product/10.2.0/db_1/bin/ocssd '
oracle 4366 0.3 1.2 154856 12356 ? S<sl 21:36 0:00 /u01/app/oracle/product/10.2.0/db_1/bin/ocssd.bin
root 4404 0.0 0.0 61216 740 pts/1 S+ 21:37 0:00 grep css
SQL> select name,TOTAL_MB,FREE_MB from v$asm_disk;
NAME TOTAL_MB FREE_MB
------------------------------ ---------- ----------
DATA_0002 964 926
DATA_0003 964 923
FRA_0000 3820 3770
DATA_0000 964 923
DATA_0001 964 929
SQL> select name,TOTAL_MB,FREE_MB from v$asm_diskgroup;
NAME TOTAL_MB FREE_MB
------------------------------ ---------- ----------
DATA 3856 3701
FRA 3820 3770
[oracle@station ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jun 19 15:52:01 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 281018368 bytes
Fixed Size 2020192 bytes
Variable Size 130026656 bytes
Database Buffers 146800640 bytes
Redo Buffers 2170880 bytes
Database mounted.
Database opened.
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIME
------------- ------------------
1 1 20 52428800 2 NO CURRENT
907797 19-JUN-12
2 1 18 52428800 2 YES INACTIVE
887601 08-JUN-12
3 1 19 52428800 2 YES INACTIVE
887605 08-JUN-12
SQL> alter database add logfile group 4 ('+DATA','+FRA') size 80m;
Database altered.
SQL> alter database add logfile group 5 ('+DATA','+FRA') size 80m;
Database altered.
SQL> alter database add logfile group 6 ('+DATA','+FRA') size 80m;
Database altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 CURRENT
2 INACTIVE
3 INACTIVE
4 UNUSED
5 UNUSED
6 UNUSED
6 rows selected.
SQL> alter database drop logfile group 2;
Database altered.
SQL> alter database drop logfile group 3;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> alter system checkpoint;
System altered.
SQL> select group#,status from v$log;
GROUP# STATUS
---------- ----------------
1 INACTIVE
4 CURRENT
5 UNUSED
6 UNUSED
SQL> alter database drop logfile group 1;
Database altered.
[root@station ~]# su - oracle
[oracle@station ~]$ export ORACLE_SID=+ASM
[oracle@station ~]$ asmcmd
ASMCMD> ls
DATA/
FRA/
ASMCMD> cd DATA
ASMCMD> ls
ORCL/
ASMCMD> cd ORCL
ASMCMD> ls
ONLINELOG/
ASMCMD> cd ONLINELOG
ASMCMD> ls
group_4.256.786383709
group_5.257.786383725
group_6.258.786383737
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 281018368 bytes
Fixed Size 2020192 bytes
Variable Size 117443744 bytes
Database Buffers 159383552 bytes
Redo Buffers 2170880 bytes
Database mounted.
With the Partitioning, OLAP and Data Mining options
[oracle@station ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jun 19 16:04:48 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1312694260, not open)
RMAN> backup as copy database format '+DATA';
[oracle@station ~]$ asmcmd
ASMCMD> ls
DATA/
FRA/
ASMCMD> cd DATA
ASMCMD> ls
ORCL/
ASMCMD> cd ORCL
ASMCMD> ls
BACKUPSET/
CONTROLFILE/
DATAFILE/
ONLINELOG/
ASMCMD> cd DATAFILE
ASMCMD> ls
EXAMPLE.261.786384425
SYSAUX.260.786384401
SYSTEM.259.786384357
UNDOTBS1.262.786384441
USERS.263.786384447
RMAN> switch database to copy;
datafile 1 switched to datafile copy "+DATA/orcl/datafile/system.259.786384357"
datafile 2 switched to datafile copy "+DATA/orcl/datafile/undotbs1.262.786384441"
datafile 3 switched to datafile copy "+DATA/orcl/datafile/sysaux.260.786384401"
datafile 4 switched to datafile copy "+DATA/orcl/datafile/users.263.786384447"
datafile 5 switched to datafile copy "+DATA/orcl/datafile/example.261.786384425"
[oracle@station ~]$ ps
PID TTY TIME CMD
5036 pts/3 00:00:00 sqlplus
5039 pts/3 00:00:00 bash
5057 pts/3 00:00:00 ps
SQL> select spid from v$session s,v$process p where s.paddr=p.addr and s.terminal='pts/3';
SPID
------------
5037
[oracle@station ~]$ cd /u01/app/oracle/admin/orcl/udump/
[oracle@station udump]$ ll *5037*
-rw-r----- 1 oracle oinstall 6785 Jun 19 16:12 orcl_ora_5037.trc
[oracle@station udump]$ cp *5037* /home/oracle/strom.sql
[oracle@station udump]$ cd /home/oracle
[oracle@station ~]$ ls
Desktop strom.sql
[oracle@station ~]$ cat strom.sql
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 4 (
'+DATA/orcl/onlinelog/group_4.256.786383709',
'+FRA/orcl/onlinelog/group_4.256.786383715'
) SIZE 80M,
GROUP 5 (
'+DATA/orcl/onlinelog/group_5.257.786383725',
'+FRA/orcl/onlinelog/group_5.257.786383729'
) SIZE 80M,
GROUP 6 (
'+DATA/orcl/onlinelog/group_6.258.786383737',
'+FRA/orcl/onlinelog/group_6.258.786383741'
) SIZE 80M
-- STANDBY LOGFILE
DATAFILE
'+DATA/orcl/datafile/system.259.786384357',
'+DATA/orcl/datafile/undotbs1.262.786384441',
'+DATA/orcl/datafile/sysaux.260.786384401',
'+DATA/orcl/datafile/users.263.786384447',
'+DATA/orcl/datafile/example.261.786384425'
CHARACTER SET AL32UTF8
;
SQL> shutdown immediate
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
SQL> alter system set control_files='+DATA','+FRA' scope=spfile;
[oracle@station dbs]$ cat initorcl.ora
spfile=+data/orcl/PARAMETERFILE/spfile.267.786385653
SQL> alter system set db_create_online_log_dest_1='+DATA';
System altered.
SQL> alter system set db_create_online_log_dest_2='+FRA';
System altered.
SQL> alter system set db_create_file_dest='+DATA';
System altered.
SQL> alter system set db_recovery_file_dest='+FRA';
System altered.
SQL> show parameter create_online;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_create_online_log_dest_1 string +DATA
db_create_online_log_dest_2 string +FRA
db_create_online_log_dest_3 string
db_create_online_log_dest_4 string
db_create_online_log_dest_5 string
SQL>
-------------------------------------------从文件系统迁移至ASM实战---------------------------------------------------------

0

收藏

atx2418

25篇文章,2W+人气,0粉丝

Ctrl+Enter 发布

发布

取消

f92360e227f9d91cdff7ea95120630ef.png
left-qr.jpg

扫一扫,领取大礼包

0

分享
qr-url?url=https%3A%2F%2Fblog.51cto.com%2Fatxstrom%2F903106
atx2418
noavatar_middle.gif