修改資料檔案路徑

tian1982tian發表於2012-10-09
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
[oracle@oracle9ivm ~]$ exit
logout
[root@oracle9ivm ~]# poweroff
Broadcast message from root (pts/0) (Thu Sep 29 16:20:42 2011):
The system is going down for system halt NOW!
[root@oracle9ivm ~]#
[root@oracle9ivm ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              79G  7.1G   68G  10% /
none                  252M     0  252M   0% /dev/shm
[root@oracle9ivm ~]# cd /dev
[root@oracle9ivm dev]# ls
adsp     fd0        fd0h410   fd0u1840  fwmonitor  loop5    md12  md24  md8       parport2  ram14    root    stdout  tap5     tty14  tty26  tty38  tty5   tty61  ttyS7     vcsa3
agpgart  fd0CompaQ  fd0h420   fd0u1920  gpmctl     loop6    md13  md25  md9       parport3  ram15    route   systty  tap6     tty15  tty27  tty39  tty50  tty62  urandom   vcsa4
arpd     fd0d360    fd0h720   fd0u2880  hdc        loop7    md14  md26  mem       port      ram2     route6  tap0    tap7     tty16  tty28  tty4   tty51  tty63  usersock  vcsa5
audio    fd0D360    fd0H720   fd0u3200  initctl    lp0      md15  md27  mice      ppp       ram3     rtc     tap1    tap8     tty17  tty29  tty40  tty52  tty7   vcs       vcsa6
cdrom    fd0D720    fd0h880   fd0u3520  input      lp1      md16  md28  midi      ptmx      ram4     sda     tap10   tap9     tty18  tty3   tty41  tty53  tty8   vcs1      xfrm
console  fd0h1200   fd0u1040  fd0u360   ip6_fw     lp2      md17  md29  mixer     pts       ram5     sda1    tap11   tcpdiag  tty19  tty30  tty42  tty54  tty9   vcs2      XOR
core     fd0h1440   fd0u1120  fd0u3840  kmsg       lp3      md18  md3   mouse0    ram       ram6     sda2    tap12   tty      tty2   tty31  tty43  tty55  ttyS0  vcs3      zero
dmmidi   fd0H1440   fd0u1440  fd0u720   log        MAKEDEV  md19  md30  net       ram0      ram7     sdb     tap13   tty0     tty20  tty32  tty44  tty56  ttyS1  vcs4
dnrtmsg  fd0h1476   fd0u1660  fd0u800   loop0      mapper   md2   md31  nflog     ram1      ram8     shm     tap14   tty1     tty21  tty33  tty45  tty57  ttyS2  vcs5
dsp      fd0h1494   fd0u1680  fd0u820   loop1      md0      md20  md4   null      ram10     ram9     skip    tap15   tty10    tty22  tty34  tty46  tty58  ttyS3  vcs6
event0   fd0h1660   fd0u1722  fd0u830   loop2      md1      md21  md5   par0      ram11     ramdisk  snd     tap2    tty11    tty23  tty35  tty47  tty59  ttyS4  vcsa
event1   fd0h360    fd0u1743  floppy    loop3      md10     md22  md6   parport0  ram12     random   stderr  tap3    tty12    tty24  tty36  tty48  tty6   ttyS5  vcsa1
fd       fd0H360    fd0u1760  full      loop4      md11     md23  md7   parport1  ram13     rawctl   stdin   tap4    tty13    tty25  tty37  tty49  tty60  ttyS6  vcsa2
[root@oracle9ivm dev]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
Command (m for help): p
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
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305
Command (m for help): p
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   83  Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@oracle9ivm dev]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              79G  7.1G   68G  10% /
none                  252M     0  252M   0% /dev/shm

[root@oracle9ivm dev]# mkfs.ext3 /dev/sdb1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1310720 inodes, 2620595 blocks
131029 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Writing inode tables: done                           
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@oracle9ivm dev]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1             82045268   7371508  70506100  10% /
none                    257820         0    257820   0% /dev/shm
[root@oracle9ivm dev]# mount /dev/sdb1 /u01/oradata/ora10g1
[root@oracle9ivm dev]# vi /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/                 /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=SWAP-sda2         swap                    swap    defaults        0 0
/dev/hdc                /media/cdrom            auto    pamconsole,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0
/dev/sdb1               /u01/oradata/ora10g1
[oracle@oracle9ivm ~]$ sqlplus /nolog
SQL*Plus: Release 9.2.0.4.0 - Production on Thu Sep 29 16:38:42 2011
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> create pfile from spfile;
File created.
SQL> exit
[oracle@oracle9ivm ~]$ cd dbs
[oracle@oracle9ivm dbs]$ vi initora10g.ora
*.aq_tm_processes=1
*.background_dump_dest='/u01/admin/ora10g/bdump'
*.compatible='9.2.0.0.0'
*.control_files='/u01/oradata/ora10g1/control01.ctl','/u01/oradata/ora10g1/control02.ctl','/u01/oradata/ora10g1/control03.ctl'
*.core_dump_dest='/u01/admin/ora10g/cdump'
*.db_block_size=8192
*.db_cache_size=33554432
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='ora10g'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ora10gXDB)'
*.fast_start_mttr_target=300
*.hash_join_enabled=TRUE
*.instance_name='ora10g'
*.java_pool_size=83886080
*.job_queue_processes=10
*.large_pool_size=16777216
*.log_archive_dest_1='LOCATION=/u01/oradata/ora10g/arch'
*.log_archive_start=TRUE
*.open_cursors=300
*.pga_aggregate_target=25165824
*.processes=150
*.query_rewrite_enabled='FALSE'
*.remote_login_passwordfile='EXCLUSIVE'
*.shared_pool_size=83886080
*.sort_area_size=524288
*.star_transformation_enabled='FALSE'
*.timed_statistics=TRUE
*.undo_management='AUTO'
*.undo_retention=10800
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/admin/ora10g/udump'
/u01/oracle/dbs
[oracle@oracle9ivm dbs]$ sqlplus /nolog
SQL*Plus: Release 9.2.0.4.0 - Production on Thu Sep 29 16:45:37 2011
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup mount pfile=/u01/oracle/dbs/initora10g.ora
ORACLE instance started.
Total System Global Area  236000356 bytes
Fixed Size                   451684 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.
SQL>
SQL> desc v$datafile;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 FILE#                                              NUMBER
 CREATION_CHANGE#                                   NUMBER
 CREATION_TIME                                      DATE
 TS#                                                NUMBER
 RFILE#                                             NUMBER
 STATUS                                             VARCHAR2(7)
 ENABLED                                            VARCHAR2(10)
 CHECKPOINT_CHANGE#                                 NUMBER
 CHECKPOINT_TIME                                    DATE
 UNRECOVERABLE_CHANGE#                              NUMBER
 UNRECOVERABLE_TIME                                 DATE
 LAST_CHANGE#                                       NUMBER
 LAST_TIME                                          DATE
 OFFLINE_CHANGE#                                    NUMBER
 ONLINE_CHANGE#                                     NUMBER
 ONLINE_TIME                                        DATE
 BYTES                                              NUMBER
 BLOCKS                                             NUMBER
 CREATE_BYTES                                       NUMBER
 BLOCK_SIZE                                         NUMBER
 NAME                                               VARCHAR2(513)
 PLUGGED_IN                                         NUMBER
 BLOCK1_OFFSET                                      NUMBER
 AUX_NAME                                           VARCHAR2(513)
SQL> col name format a50
SQL> set linesize 500
SQL> select name from v$datafile;
NAME
--------------------------------------------------
/u01/oradata/ora10g/system01.dbf
/u01/oradata/ora10g/undotbs01.dbf
/u01/oradata/ora10g/cwmlite01.dbf
/u01/oradata/ora10g/drsys01.dbf
/u01/oradata/ora10g/example01.dbf
/u01/oradata/ora10g/indx01.dbf
/u01/oradata/ora10g/odm01.dbf
/u01/oradata/ora10g/tools01.dbf
/u01/oradata/ora10g/users01.dbf
/u01/oradata/ora10g/xdb01.dbf
10 rows selected.
SQL> alter database rename file '/u01/oradata/ora10g/system01.dbf'  to '/u01/oradata/ora10g1/system01.dbf';
alter database rename file '/u01/oradata/ora10g/undotbs01.dbf' to '/u01/oradata/ora10g1/undotbs01.dbf';
alter database rename file '/u01/oradata/ora10g/cwmlite01.dbf' to '/u01/oradata/ora10g1/cwmlite01.dbf';
alter database rename file '/u01/oradata/ora10g/drsys01.dbf'   to '/u01/oradata/ora10g1/drsys01.dbf';
alter database rename file '/u01/oradata/ora10g/example01.dbf' to '/u01/oradata/ora10g1/example01.dbf';
alter database rename file '/u01/oradata/ora10g/indx01.dbf'    to '/u01/oradata/ora10g1/indx01.dbf' ;
alter database rename file '/u01/oradata/ora10g/odm01.dbf'     to '/u01/oradata/ora10g1/odm01.dbf';
alter database rename file '/u01/oradata/ora10g/tools01.dbf'   to '/u01/oradata/ora10g1/tools01.dbf';
alter database rename file '/u01/oradata/ora10g/users01.dbf'   to '/u01/oradata/ora10g1/users01.dbf';
alter database rename file '/u01/oradata/ora10g/xdb01.dbf'     to '/u01/oradata/ora10g1/xdb01.dbf';
Database altered.
SQL>
Database altered.
SQL>
Database altered.
SQL>
Database altered.
SQL>
Database altered.
SQL>
Database altered.
SQL>
Database altered.
SQL>
Database altered.
SQL>
Database altered.
SQL>
Database altered.
SQL> select name from v$datafile;
NAME
--------------------------------------------------
/u01/oradata/ora10g1/system01.dbf
/u01/oradata/ora10g1/undotbs01.dbf
/u01/oradata/ora10g1/cwmlite01.dbf
/u01/oradata/ora10g1/drsys01.dbf
/u01/oradata/ora10g1/example01.dbf
/u01/oradata/ora10g1/indx01.dbf
/u01/oradata/ora10g1/odm01.dbf
/u01/oradata/ora10g1/tools01.dbf
/u01/oradata/ora10g1/users01.dbf
/u01/oradata/ora10g1/xdb01.dbf
10 rows selected.
SQL> desc v$logfile;
 Name                                                                                                                                                                                  Null?     Type
 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 GROUP#                                                                                                                                                                         NUMBER
 STATUS                                                                                                                                                                         VARCHAR2(7)
 TYPE                                                                                                                                                                           VARCHAR2(7)
 MEMBER                                                                                                                                                                         VARCHAR2(513)
SQL> col member format a50
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------
/u01/oradata/ora10g/redo03.log
/u01/oradata/ora10g/redo02.log
/u01/oradata/ora10g/redo01.log
SQL> alter database rename file '/u01/oradata/ora10g/redo03.log' to '/u01/oradata/ora10g1/redo03.log';
Database altered.
SQL> alter database rename file '/u01/oradata/ora10g/redo02.log' to '/u01/oradata/ora10g1/redo02.log';
Database altered.
SQL> alter database rename file '/u01/oradata/ora10g/redo01.log' to '/u01/oradata/ora10g1/redo01.log';
Database altered.
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------
/u01/oradata/ora10g1/redo03.log
/u01/oradata/ora10g1/redo02.log
/u01/oradata/ora10g1/redo01.log
SQL> alter database open;
Database altered.
SQL>
~

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/16400082/viewspace-745983/,如需轉載,請註明出處,否則將追究法律責任。

相關文章