Alter database operation

Source: Internet
Author: User

1 alter Database: modify data files

Alter database datafile 4 offline;

Alter database datafile '/opt/Oracle/datafile/users01.dbf' offline;

Alter database datafile '/opt/Oracle/datafile/users01.dbf' resize 100 m;

Alter database datafile '/opt/Oracle/datafile/users01.dbf' autoextend on next 100 m maxsize 1000 m;

Alter database datafile 4 end backup;

2 alter Database: Modify temporary files (tempfile)

Alter database tempfile 4 resize 100 m;

Alter database tempfile 4 autoextend on next 100 m maxsize 1000 m;

Alter database tempfile 4 drop including datafiles;

Alter database tempfile 4 offline;

3 alter Database: archivelog command

Alter database archivelog;

Alter database noarchivelog;

Alter database force logging;

Alter database clear logfile '/opt/Oracle/logfiles/redo01.rdo ';

Alter database clear Unarchived logfile '/opt/Oracle/logfiles/redo01.rdo ';

Alter database add Supplemental log data;

Alter database add Supplemental log data (primary key, unique );

Alter database drop Supplemental log data;

4 alter Database: Control File Operations

Alter Database Backup controlfile to trace;

Alter Database Backup controlfile to trace as '/opt/Oracle/logfile_backup/backup_logfile.trc' reuse resetlogs;

Alter Database Backup controlfile to '/opt/Oracle/logfile_backup/backup_logfile.ctl ';

5 alter Database: create a data file

Alter database create datafile '/opt/Oracle/datafile/users01.dbf 'as'/opt/Oracle/datafile/users01.dbf ';

Alter database create datafile 4 as '/opt/Oracle/datafile/users01.dbf ';

Alter database create datafile '/opt/Oracle/datafile/users01.dbf' as new;

6 alter Database: log file command

Alter database add logfile group 2 ('/opt/Oracle/logfiles/redo02a. rdo', '/opt/Oracle/logfile/redo02b. rdo') size 300 m reuse;

Alter database add logfile member '/opt/Oracle/logfiles/redo02c. rdo' to gourp 2

Alter database add logfile thread 3 group 2 ('/opt/Oracle/logfiles/redo02a. rdo', '/opt/Oracle/logfiles/redo02b. rdo') size 300 m reuse;

Alter database drop logfile group 3

Alter database drop logfile member '/opt/Oracle/logfiles/redo02b. rdo ';

7. Alter Database: Install and open a database

Alter database Mount;

Alter database open;

8 alter Database: Move or rename database files or online redo logs

Note: The database must have been installed before renaming or moving online redo logs. Only when the database has been installed or the data file is offline can the data files in the database be moved.

Alter database rename File '/ora/datafile/oldfile. dbf' to'/ora/datafile/newfile. dbf ';

9 alter Database: Open the database in read-only mode

Alter database open read only;

10 alter Database: Use resetlogs to open data

Alter database open resetlogs;

11 alter Database: Restore the database

We recommend that you use the recover command to recover the database.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.