Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

[reading notes] ORACLE database file management

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Database files include data files, log files, control files and password files, parameter files and so on. The management of these files can be regarded as a process of adding, deleting, changing and checking.

1. Data file management

Increase:

Add data files when adding new tablespaces

Create tablespace test_2016 datafile'/ u01 size size autoextend on next 10m oracle 100m

Add data files to the table space

Alter tablespace test_2016 add datafile'/ u01 size size 10m

Alter tablespace test_2016 add datafile'/ u01 size size 10m

Delete:

Delete a data file

Alter tablespace test_2016 drop datafile 7

Alter tablespace test_2016 drop datafile'/ u01qqappUniqr oracle.oradataUniplicateorclapplic02.dbf'

The data file cannot be deleted until it is empty.

Delete tablespaces:

Drop tablespace test_2016 including contents and datafiles

Change: change the location of the physical file

There are two ways to modify the physical location of the data file, one is to modify the physical location after shutdown, and the other is to modify the physical location after offline.

The first way: change the location of the physical file after shutting down

SQL > shutdown immediate

[oracle@mycentos orcl] $mv test_0*.. /

[oracle@mycentos orcl] $cd..

[oracle@mycentos oradata] $ls

Orcl test_01.dbf test_02.dbf

[oracle@mycentos oradata] $

SQL > startup nomount

SQL > alter database mount

SQL > alter database rename file'/ u01ActionApplicationoracle.oradataUniplicationorclUniplicoradata 01.dbf'to'/ u01Lax appLiglyoracleUniplicationoradataUniplicationoradataGrease 01.dbf'

SQL > alter database rename file'/ u01ActionApplicationoracleUniplicasoradataUniplemorclUnition02.dbf'to'/ u01Lax appLiglyoraclecosoradataUniplicationsoradataloradataUniplication02.dbf'

SQL > alter database open

SQL > select file_name from dba_data_files where file_name like'% test%'

FILE_NAME

/ u01/app/oracle/oradata/test_01.dbf

/ u01/app/oracle/oradata/test_02.dbf

The second way: move the data file after the tablespace is offline

SQL > alter tablespace test_2016 offline

Operations in the operating system:

[oracle@mycentos oradata] $mv test_0* orcl/

[oracle@mycentos oradata] $cd orcl/

[oracle@mycentos orcl] $ls test_0*

Test_01.dbf test_02.dbf

SQL > alter database rename file'/ u01According to an oracle to to'/ u01qapplicasoracleUniplex

SQL > alter database rename file'/ u01According to an oracle to / u01 to, an oracle to'/ u01 aphorism

SQL > alter tablespace test_2016 online

Change the data file size:

Alter database datafile'/ u01 resize resize 5m

Check:

Select file_name,file_id,online_status from dba_data_files

two。 Online redo log file management

Increase:

Add log members:

Alter database add logfile member 'path' to group t

SQL > alter database add logfile member'/ u01 to group to group 1

Log filegroup increased:

Alter database add logfile [group n] ('path') size 100m

SQL > alter database add logfile'/ u01 size size 50m

SQL > alter database add logfile group 6'/ u01PlacelPlacement oradataPlacement orclBlueredox06.log' size 50M * * can add log filegroups across sequences

Delete:

Delete log members:

Alter database drop logfile member 'path'

SQL > alter database drop logfile member'/ u01Accord oradataAccord redox 11.log'

Delete a log group:

SQL > alter database drop logfile group 6 words-only log groups with INACTIVE status can be deleted

Change:

Instead of shutting down the database to change the location of the log files, add a new log filegroup directly to the database, and then delete the old filegroup.

Check:

Select * from v$log

Select * from v$logfile order by group#

3. Control file management

The name of the database and the physical layout of the database are recorded in the control file, including the location of the data file, online log file, backup file, database current SCN and other important information. The control file will be read in the second stage of database startup.

Multiple copies of the control file are required to prevent damage to the database if a single file is damaged. When the database modifies the control file, all copies are modified at the same time.

View method:

Select * from v$controlfile

Show parameter control_files

To create a copy of the control file:

1) modify the parameter file

Alter system set control_files ='/ u01According to oradataUniverse control 01.ctlmagic scope=spfile, u01qaphort oraclegram, flashrecoveryblade, oradata, or control02.ctl`

Alter system set control_files ='/ u01According to oraclecontrol 01.ctl'

2) stop the database

SQL > shutdown immediate

3) copy control files

[oracle@yoon yoon] $cp / u01/app/oracle/oradata/orcl/control01.ctl / u01/app/oracle/flash_recovery_area/orcl/control02.ctl

4) start the database

SQL > statup

5) verify and view v$controlfile

SQL > select name from v$controlfile

The step of deleting a copy of the control file is one step less than the step of creating the copy control file.

4. Password file management:

For more information, see: summary of password files

5. Parameter file management

Parameter files are divided into static parameter files (pfile) and dynamic parameter files (Spile). Pfile is a text document and spfile is a binary file.

Parameter modification:

Alter system set parameter=value [scope=spfile | memory | both]

In scope, spfile means that the modification is in the spile file and does not affect the current setting; memory modifies the current setting immediately, but does not modify spile;both. It modifies both the spfile and the current setting.

For static parameters, you can only use scope=spfile

Order in which files are loaded during Oracle startup: spfilesid.ora spfile.ora initsid.ora

Location of the parameter file:

Show parameter spfile

Show parameter pfile

Creation of parameter file:

Create pfile='...'

Create spile='...'

How to start the database with the specified parameter file:

Startup pfile='...'

Startup spfile='...'

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report