Oracle bbed restore non-archive databases

Source: Internet
Author: User

Solemnly declare that BBED is an internal Oracle tool. If this database is not supported once you use oracle, exercise caution.

1. Create bbed (10 Gb test)

[Oracle @ rac1 ~] $ Cd $ ORACLE_HOME/rdbms/lib

[Oracle @ rac1 lib] $ make-f ins_rdbms.mk BBED = $ ORACLE_HOME/bin/bbed

[Oracle @ rac1 lib] $ cd $ ORACLE_HOME/bin

[Oracle @ rac1 bin] $ ls-lrt bbed
-Rwxr-xr-x 1 oracle oinstall 548768 Dec 17 bbed

2. Use the bbed Tool

(1) create a par configuration file

SQL> select file # | ''| name |'' | bytes from v $ datafile; put the query results in/home/oracle/bbed/filelist.txt.

[Oracle @ rac1 ~] $ Cat/home/oracle/bbed. par

Blocksize = 8192

/Home/oracle/bbed/filelist.txt

Mode = edit

(2) log on to bbed

[Oracle @ rac1 bbed] $ bbed parfile = bbed. par

The default password is blockedit.

BBED> help all -- view all available commands

(3) Common commands

Set sets the current environment

Show to view the current environment parameters, similar to the command with the same name as sqlplus.

Dump: list the content of a specified block

Find finds the specified string in the specified block. The result shows the string and Its offset -- offset, which is the number of bytes in the block.

Modify modifies the value of the specified offset of the specified block, which can be modified online.

Copy: copy the content of a block to another block.

Verify checks whether there are bad blocks in the current environment

Sum calculates the block checksum. After modify, the block is identified as a bad block. current checksum and reqired checksum are inconsistent. The sum command can calculate a new checksum and apply it to the current block.

Undo rolls back the current modification operation. If an error occurs by mistake, undo will be OK and return to the original state.

Revert rolls back all previous modification operations, which means undo all

(4) directly modify the start database of the Data File Header

SQL> startup
ORACLE instance started.

Total System Global Area 788529152 bytes
Fixed Size 2087216 bytes
Variable Size 423626448 bytes
Database Buffers 356515840 bytes
Redo Buffers 6299648 bytes
Database mounted.
ORA-01113: file 4 needs media recovery
ORA-01110: data file 4: '/opt/ora10g/oradata/orcl/users01.dbf'


SQL> select name, checkpoint_change # from v $ datafile;

NAME CHECKPOINT_CHANGE #
--------------------------------------------------------------------
/Opt/ora10g/oradata/orcl/maid 13185657
/Opt/ora10g/oradata/orcl/undotbs01.dbf 13185657
/Opt/ora10g/oradata/orcl/sysaux01.dbf 13185657
/Opt/ora10g/oradata/orcl/users01.dbf 13185657
/Opt/ora10g/oradata/orcl/test_data.dbf 13185657
/Opt/ora10g/oradata/orcl/xldata01.dbf 13185657
/Opt/ora10g/oradata/orcl/timdata01.dbf 13185657
/Opt/ora10g/oradata/orcl/xllogtmpdata01.dbf 13185657
/Opt/ora10g/oradata/orcl/user02.dbf 13185657
13185657 to hexadecimal C93279

SQL> select name, checkpoint_change # from v $ datafile_header;

NAME CHECKPOINT_CHANGE #
--------------------------------------------------------------------
/Opt/ora10g/oradata/orcl/maid 13185657
/Opt/ora10g/oradata/orcl/undotbs01.dbf 13185657
/Opt/ora10g/oradata/orcl/sysaux01.dbf 13185657
/Opt/ora10g/oradata/orcl/users01.dbf 5609780 5609780 is converted to hexadecimal 559934
/Opt/ora10g/oradata/orcl/test_data.dbf 13185657
/Opt/ora10g/oradata/orcl/xldata01.dbf 13185657
/Opt/ora10g/oradata/orcl/timdata01.dbf 13185657
/Opt/ora10g/oradata/orcl/xllogtmpdata01.dbf 13185657
/Opt/ora10g/oradata/orcl/user02.dbf 13185657

We can see that the scn of the database users01.dbf is 5609780, which is obviously a backup data file. When oracle opens a database, it must check the control file and the scn of the data file header before opening the database, so here we use ddeb to modify the data file header so that it is the same as the scn of other data files, to achieve the goal of database startup.

  • 1
  • 2
  • 3
  • Next Page

Related Article

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.