更改Oracle数据文件名及数据文件存放路径

SQL> select * from v$dbfile;        FILE# NAME ---------- --------------------------------------------------------------------------------          1 /db2/oracle/oradata/db2/system01.dbf          2 /db2/oracle/oradata/db2/sysaux01.dbf          3 /db2/oracle/oradata/db2/undotbs01.dbf          4 /db2/oracle/oradata/db2/users01.dbf          5 /db2/oracle/product/11.2.0/db_1/dbs/D:ORACLE11GADMINORADATAADMINgg01.dbf          6 /db2/oracle/oradata/db2/db201.dbf

一、关闭数据库进行修改 [[email protected] ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 26 17:43:38 2012

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down.

[[email protected] ~]$ mv /db2/oracle/product/11.2.0/db_1/dbs/D\:ORACLE11GADMINORADATAADMINgg01.dbf  /db2/oracle/oradata/db2/gg01.dbf

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 26 17:48:31 2012

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

Connected to an idle instance.

SQL> startup mount ORACLE instance started.

Total System Global Area  521936896 bytes Fixed Size      2214936 bytes Variable Size    163578856 bytes Database Buffers   352321536 bytes Redo Buffers      3821568 bytes Database mounted.

SQL> alter database rename file ‘/db2/oracle/product/11.2.0/db_1/dbs/D\:ORACLE11GADMINORADATAADMINgg01.dbf‘ to ‘/db2/oracle/oradata/db2/gg01.dbf‘;

Database altered.

SQL> select * from v$dbfile;        FILE# NAME ---------- --------------------------------------------------------------------------------          1 /db2/oracle/oradata/db2/system01.dbf          2 /db2/oracle/oradata/db2/sysaux01.dbf          3 /db2/oracle/oradata/db2/undotbs01.dbf          4 /db2/oracle/oradata/db2/users01.dbf          5 /db2/oracle/oradata/db2/gg01.dbf          6 /db2/oracle/oradata/db2/db201.dbf   6 rows selected

二、在线修改 方法1:表空间offline SQL> select  *  from dba_data_files;   FILE_NAME                                                                           FILE_ID TABLESPACE_NAME                     BYTES     BLOCKS STATUS    RELATIVE_FNO AUTOEXTENSIBLE   MAXBYTES  MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS ONLINE_STATUS -------------------------------------------------------------------------------- ---------- ------------------------------ ---------- ---------- --------- ------------ -------------- ---------- ---------- ------------ ---------- ----------- ------------- /db2/oracle/oradata/db2/system01.dbf                                                      1 SYSTEM                          734003200      89600 AVAILABLE            1 YES            3435972198    4194302         1280  732954624       89472 SYSTEM /db2/oracle/oradata/db2/sysaux01.dbf                                                      2 SYSAUX                          629145600      76800 AVAILABLE            2 YES            3435972198    4194302         1280  628097024       76672 ONLINE /db2/oracle/oradata/db2/undotbs01.dbf                                                     3 UNDOTBS1                        618659840      75520 AVAILABLE            3 YES            3435972198    4194302          640  617611264       75392 ONLINE /db2/oracle/oradata/db2/users01.dbf                                                       4 USERS                             5242880        640 AVAILABLE            4 YES            3435972198    4194302          160    4194304         512 ONLINE /db2/oracle/oradata/db2/gg01.dbf                                                          5 GG                              104857600      12800 AVAILABLE            5 NO                      0          0            0  103809024       12672 ONLINE /db2/oracle/oradata/db2/db201.dbf                                                         6 DB2                             104857600      12800 AVAILABLE            6 NO                      0          0            0  103809024       12672 ONLINE   SQL> alter tablespace gg offline;   Tablespace altered

SQL> host mv /db2/oracle/oradata/db2/gg01.dbf /db2/oracle/oradata/db2/admin.dbf

SQL> alter database rename file ‘/db2/oracle/oradata/db2/gg01.dbf‘ to ‘/db2/oracle/oradata/db2/admin.dbf‘;   Database altered

SQL> alter tablespace gg online;   Tablespace altered

SQL> select  *  from dba_data_files;   FILE_NAME                                                                           FILE_ID TABLESPACE_NAME                     BYTES     BLOCKS STATUS    RELATIVE_FNO AUTOEXTENSIBLE   MAXBYTES  MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS ONLINE_STATUS -------------------------------------------------------------------------------- ---------- ------------------------------ ---------- ---------- --------- ------------ -------------- ---------- ---------- ------------ ---------- ----------- ------------- /db2/oracle/oradata/db2/system01.dbf                                                      1 SYSTEM                          734003200      89600 AVAILABLE            1 YES            3435972198    4194302         1280  732954624       89472 SYSTEM /db2/oracle/oradata/db2/sysaux01.dbf                                                      2 SYSAUX                          629145600      76800 AVAILABLE            2 YES            3435972198    4194302         1280  628097024       76672 ONLINE /db2/oracle/oradata/db2/undotbs01.dbf                                                     3 UNDOTBS1                        618659840      75520 AVAILABLE            3 YES            3435972198    4194302          640  617611264       75392 ONLINE /db2/oracle/oradata/db2/users01.dbf                                                       4 USERS                             5242880        640 AVAILABLE            4 YES            3435972198    4194302          160    4194304         512 ONLINE /db2/oracle/oradata/db2/admin.dbf                                                         5 GG                              104857600      12800 AVAILABLE            5 NO                      0          0            0  103809024       12672 ONLINE /db2/oracle/oradata/db2/db201.dbf                                                         6 DB2                             104857600      12800 AVAILABLE            6 NO                      0          0            0  103809024       12672 ONLINE   方法2:数据文件脱机 (方法2必须在数据库归档模式下进行) SQL> alter database datafile 5 offline; alter database datafile 5 offline * ERROR at line 1: ORA-01145: offline immediate disallowed unless media recovery enabled

SQL> archive log list; Database log mode        No Archive Mode Automatic archival        Disabled Archive destination        USE_DB_RECOVERY_FILE_DEST Oldest online log sequence     69 Current log sequence        71

开归档 [[email protected] ~]$ mkdir /db2/oracle/archivelog [[email protected] ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 26 18:15:52 2012

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down.

SQL> startup mount ORACLE instance started.

Total System Global Area  521936896 bytes Fixed Size      2214936 bytes Variable Size    163578856 bytes Database Buffers   352321536 bytes Redo Buffers      3821568 bytes Database mounted. SQL> alter system set log_archive_dest_1=‘location=/db2/oracle/archivelog/‘;

System altered.

SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list Database log mode        Archive Mode Automatic archival        Enabled Archive destination        /db2/oracle/archivelog/ Oldest online log sequence     69 Next log sequence to archive   71 Current log sequence        71

SQL> alter database datafile 5 offline;

Database altered.

SQL> host mv /db2/oracle/oradata/db2/admin.dbf /db2/oracle/oradata/db2/gg01.dbf

SQL> alter database rename file ‘/db2/oracle/oradata/db2/admin.dbf‘ to ‘/db2/oracle/oradata/db2/gg01.dbf‘;

Database altered.

SQL> alter database datafile 5 online; alter database datafile 5 online * ERROR at line 1: ORA-01113: file 5 needs media recovery ORA-01110: data file 5: ‘/db2/oracle/oradata/db2/gg01.dbf‘

SQL> recover datafile 5; Media recovery complete.

SQL> alter database datafile 5 online;

Database altered.

SQL> select file_id,file_name,tablespace_name,online_status from dba_data_files;      FILE_ID FILE_NAME                                                                        TABLESPACE_NAME                ONLINE_STATUS ---------- -------------------------------------------------------------------------------- ------------------------------ -------------          1 /db2/oracle/oradata/db2/system01.dbf                                             SYSTEM                         SYSTEM          2 /db2/oracle/oradata/db2/sysaux01.dbf                                             SYSAUX                         ONLINE          3 /db2/oracle/oradata/db2/undotbs01.dbf                                            UNDOTBS1                       ONLINE          4 /db2/oracle/oradata/db2/users01.dbf                                              USERS                          ONLINE          5 /db2/oracle/oradata/db2/gg01.dbf                                                 GG                             ONLINE          6 /db2/oracle/oradata/db2/db201.dbf                                                DB2                            ONLINE

时间: 2024-10-22 11:11:19

更改Oracle数据文件名及数据文件存放路径的相关文章

java基础--->文件--->文件存放路径:绝对路径和相对路径

内容概述: 在实际的工程中,有时会需要存储一些文件,如存放一些图片.数据文件等,存放这些文件时考虑将这些文件存放在哪里. 通常有两种方法来获取文件存放路径: 方法一,获取系统有效盘符  如D:/,然后进行路径扩展,将扩展后的路径作为存放这些文件的根路径.这种方法有一个缺点,那就是在不同的操作系统中进行程序迁移时,会很麻烦: 方法二,获取当前文件夹(即程序工程目录)如d:/projectName,然后进行路径扩展,将扩展后的路径作为存放这些文件的根路径.最终存放程序文件的目录和程序代码目录在同一个

更改Outlook 2013中Exchange数据文件存放路径

昨天新入职目前所在的公司,在原公司一直都是直接使用Outlook设置用户名和密码后,然后将*.pst邮件的数据文件保存在其他盘符,以防止在更新操作系统时出现邮件丢失的情况:但是目前公司使用的是Exchange,在Outlook2013中配置用户名后不支持对数据文件*.ost路径的修改,文件默认路径如下: 不是使用exchange的邮箱如下: 可以对数据文件的路径进行更改:但是使用了exchange的邮箱如下图,不能进行修改: 在度娘中搜了几个方法后,根据描述的内容也没能配置成功(请容许我2一下)

smarty初始配置,文件存放路径

<?php define("ROOT",str_replace("\\","/",dirname(__FILE__)).'/'); //常量ROOT中指定项目根目录.\\转义字符,将\转为/. //echo str_replace("\\","/",dirname(__FILE__))."/";//找到指定项目的目录 require ROOT.'libs/Smarty.class.

Oracle修改数据文件名/移动数据文件

生产上有时会用到数据文件的迁移,下边示例几种数据文件的迁移方法. 数据库版本 [email protected]>select * from v$version; select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.4

查看mysql数据文件存放路径

进入mysql终端 mysql>show variables like '%datadir%'; 出来的结果即是! mysql> show variables like '%datadir%'; +---------------+------------------------+ | Variable_name | Value                  | +---------------+------------------------+ | datadir       | /usr

oracle数据库备份、还原 (如何将Oracle 11g备份的dat文件导入到10g数据库里面)

如何将Oracle 11g备份的dat文件导入到10g数据库里面 解决方法: 导出的时候后面加上目标数据库的版本号 导出: 在SQL plus下执行:create or replace directory file_path as 'E:\';--创建导出\导入文件存放路径(我的是放在E盘) 在cmd里面执行:expdp 用户名/密码@服务命名  directory=file_path dumpfile=导出数据库文件名.dat  schemas=用户名 logfile=baklog.log  

Python Django 之 静态文件存放设置

一.静态文件存放路径设置STATICFILES_DIRS 1.在django项目目录下面新建静态文件保存目录 2.在setting中添加相应寻找静态文件目录的配置 STATICFILES_DIRS=( os.path.join(BASE_DIR,"static"),) 3.将jquery放入相应路径中 4.验证静态文件的路径设置 1)url from django.contrib import adminfrom django.urls import pathfrom blog imp

Linux查看文件安装路径与文件所在路径

一.查看文件安装路径: 由于软件安装的地方不止一个地方,所有先说查看文件安装的所有路径(地址). 这里以Oracle为例.比如说我安装了Oracle,但是不知道文件都安装在哪些地方.放在哪些文件夹里,可以用下面的命令查看所有的文件路径 在终端输入: whereis oracle 回车,如果你安装好了Oracle,就会显示文件安装的地址,例如我的显示(安装地址可能会不同) oracle: /usr/bin/oracle /usr/lib/oracle /usr/share/oracle /usr/

MySQL DDL操作--------指定表数据文件存放目录最佳实战

1. 背景 * 在MYSQL中建立一张数据表,在其数据目录对应的数据库目录下都有对应表的.frm文件,.frm文件是用来保存每个数据表的元数据(meta)信息,包括表结构的定义等,.frm文件跟数据库存储引擎无关,也就是任何存储引擎的数据表都必须有.frm文件,命名方式为数据表名.frm,如user.frm. .frm文件可以用来在数据库崩溃时恢复表结构. * MySQL文件包括MySQL所建数据库文件和MySQL所用引擎创建的数据库文件. * .frm 文件与操作系统和数据库引擎无关,都有这么