从文件系统迁移至ASM实战 注意:(这里就不解释每一行的意思了,这篇是给有点基础的人看的)
-------------------------------------------从文件系统迁移至ASM实战---------------------------------------------------------
[root@station bin]# fdisk -l
-------------------------------------------从文件系统迁移至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
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
/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
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
/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
# 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"
;;
# 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
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
[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)
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&
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
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
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
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.
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;
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
---------- ---------- ---------- ---------- ---------- --- ----------------
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
887601 08-JUN-12
3 1 19 52428800 2 YES INACTIVE
887605 08-JUN-12
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
---------- ----------------
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;
---------- ----------------
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
[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.
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.
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 /
[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
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"
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
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
------------
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]$ 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
;
[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.
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
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.
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.
System altered.
SQL> alter system set db_recovery_file_dest='+FRA';
System altered.
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>
------------------------------------ ----------- ------------------------------
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实战---------------------------------------------------------
©著作权归作者所有:来自51CTO博客作者atx2418的原创作品,谢绝转载,否则将追究法律责任
0
收藏
推荐专栏更多
猜你喜欢
我的友情链接
当前控制文件损坏_不完全恢复_用控制文件二进制备份_数据不丢_不需备份
DNS域名系统
ELK 日志分析系统
如何查看Linux操作系统版本?
免费的上网行为管理系统和软路由系统推荐。
linux 的date命令及系统时间设置
linux命令eval的用法
Panabit流量管理系统使用经验
Linux MemFree与MemAvailable的区别
常用查看Linux系统信息命令
64位系统上使用××× Client端
多方面来保证Linux服务器的基本系统安全
Linux磁盘IO调度算法
Redis主从+sentinel(哨兵)+keepalived
Ansible AWX基础配置和使用
Kubernetes监控方案之Grafana + Alertmanager + Prometheus
搭建高可用wordpress(keepalived+HAProxy)
NFS服务的用户身份映射
搭建zabbix监控系统
![f92360e227f9d91cdff7ea95120630ef.png](https://i-blog.csdnimg.cn/blog_migrate/224cfb471d126971b1596dad7c9cd022.png)
![left-qr.jpg](https://i-blog.csdnimg.cn/blog_migrate/70bc5c3884aa823724e684bce77428e2.jpeg)
扫一扫,领取大礼包
转载于:https://blog.51cto.com/atxstrom/903106
Ctrl+Enter 发布
发布
取消