search
HomeDatabaseMysql TutorialOracle数据库文件路径变更

环境:RHEL 6.4 + Oracle 11.2.0.3 情景一:只是部分普通数据文件迁移,可以在线操作。 1.将对应表空间offline,移动数据文件到新

环境:RHEL 6.4 + Oracle 11.2.0.3

情景一:只是部分普通数据文件迁移,可以在线操作。

1.将对应表空间offline,移动数据文件到新路径

2.数据文件alter database rename file '' to '';

3.再将表空间online

情景二:所有数据文件迁移。

本文是针对情景二的实验,需求:主机/oradata挂节点变更为/usr2.在/usr2建立oradata文件夹来存放之前/oradata的所有文件。

操作步骤:

1.查看当前数据库的数据文件,临时文件,日志文件,控制文件,参数文件等信息。

2.根据当前spfile创建pfile文件,正常关闭数据库,移动源数据库文件到新的存储路径。

3.修改数据库参数文件,更改控制文件路径为新的存储路径,用改好的pfile文件启动数据库到mount状态。

4.重定向数据库的所有数据文件、日志文件路径,然后正常打开数据库。

5.核查各文件路径没有问题,根据当前pfile创建spfile,重启数据库实例。

1.查看当前数据库的数据文件,临时文件,日志文件,控制文件,,参数文件等信息。

 

SQL> select name from v$datafile; NAME oradata/sysdata/jingyu/system01.dbf /oradata/sysdata/jingyu/sysaux01.dbf /oradata/sysdata/jingyu/undotbs01.dbf /oradata/sysdata/jingyu/users01.dbf SQL> select name from v$tempfile; NAME oradata/sysdata/jingyu/temp01.dbf SQL> select member from v$logfile; MEMBER oradataoradata/sysdata/jingyu/redo01.log SQL> select name from v$controlfile; NAME oradata/sysdata/jingyu/control01.ctl /opt/app/oracle/fast_recovery_area/jingyu/control02.ctl SQL> show parameter pfile NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ spfile string dbhome_1/dbs/spfilejingyu.ora

 

2.根据当前spfile创建pfile文件,正常关闭数据库,移动源数据库文件到新的存储路径。

 

SQL> create pfile from spfile; File created. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. --移动源数据库文件到新的存储路径: a.建立/usr2。 b./etc/fstab配置,更改/oradata为/usr2。 c.mount /usr2 d./usr2下建立oradata文件夹。 e./usr2下文件移动到/usr2/oradata下。 f.处理相关目录权限。 g.umount -l /oradata

 

3.修改数据库参数文件,更改控制文件路径为新的存储路径,用改好的pfile文件启动数据库到mount状态。

 

$ cd $ORACLE_HOME/dbs $ more initjingyu.ora jingyu.__db_cache_size=6677331968 jingyu.__java_pool_size=33554432 jingyu.__large_pool_size=33554432 jingyu.__oracle_base#ORACLE_BASE set from environment jingyu.__pga_aggregate_target=5402263552 jingyu.__sga_target=8086618112 jingyu.__shared_io_pool_size=0 jingyu.__shared_pool_size=1275068416 jingyu.__streams_pool_size.audit_file_dest.audit_trail.compatible.control_files,.db_block_size.db_domain..db_recovery_file_dest.db_recovery_file_dest_size.diagnostic_dest.dispatchers.memory_target.open_cursors.processes.remote_login_passwordfile.sessions.undo_tablespace SQL nomount ORACLE instance started. Total System Global Area 1.3429E+10 bytes Fixed Size 2241064 bytes Variable Size 6744444376 bytes Database Buffers 6677331968 bytes Redo Buffers 4636672 bytes SQL mount; Database altered. 4.重定向数据库的所有数据文件、日志文件路径,然后正常打开数据库。

 

SQLrename ; Database altered. SQLrename ; Database altered. SQLrename ; Database altered. SQLrename ; Database altered. SQLrename ; Database altered. SQLrename ; Database altered. SQLrename ; Database altered. SQLrename ; Database altered. SQL; Database altered.

 

5.核查各文件路径没有问题,根据当前pfile创建spfile,重启数据库实例。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools