Home Database Mysql Tutorial 同时丢失参数文件、控制文件及redologfile的不完全恢复(有数据

同时丢失参数文件、控制文件及redologfile的不完全恢复(有数据

Jun 07, 2016 pm 03:57 PM
lost parameter control document

转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/30839817 ##########恢复前的准备工作 1、做个热备 select alter tablespace ||tablespace_name|| begin backup; ||chr(10)|| host cp ||file_name|| /backup ||chr(10)|| alter tablespace |

转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/30839817

 ##########恢复前的准备工作

1、做个热备
   select
    'alter tablespace '||tablespace_name|| ' begin backup;' ||chr(10)||
    'host cp '||file_name||' /backup' ||chr(10)||
    'alter tablespace '||tablespace_name|| ' end backup;'
   from dba_data_files order by tablespace_name;
Copy after login

sys@PROD> alter tablespace SYSAUX begin backup;

2、日志做切换

sys@PROD> alter system switch logfile;

System altered.

sys@PROD> alter system switch logfile;

System altered.

sys@PROD> alter system switch logfile;

System altered.

sys@PROD> conn gyj/gyj
Connected.
gyj@PROD> select * from gyj_test1;

        ID NAME
---------- ----------------------------------------------------------------------------------------------------
         1 guoyJ
         2 BBBBB

gyj@PROD> insert into gyj_test1 values(3,'CCCCC');

1 row created.

gyj@PROD> commit;

Commit complete.

gyj@PROD> alter system switch logfile;

System altered.

gyj@PROD> alter system switch logfile;

System altered.
Copy after login

3、丢失参数文件,控制文件,redo日志文件

[oracle@jfdb dbs]$ rm  -rf spfile.ora
[oracle@jfdb dbs]$ rm -rf spfilePROD.ora
[oracle@jfdb dbs]$ rm -rf initPROD.ora 
[oracle@jfdb PROD]$ rm -rf control0*
[oracle@jfdb PROD]$ rm -rf redo0* 
Copy after login

###########开始恢复
[oracle@jfdb trace]$ cat alert_PROD.log vi /tmp/pfile.ora processes = 150 sga_max_size = 900M sga_target = 900M control_files = "/u01/app/oracle/oradata/PROD/control01.ctl" control_files = "/u01/app/oracle/oradata/PROD/control02.ctl" _controlfile_update_check= "OFF" db_block_size = 8192 log_archive_dest_1 = "location=/arch" undo_tablespace = "UNDOTBS" _in_memory_undo = FALSE service_names = "PROD,crm,oa" local_listener = "(DESCRIPTION= (ADDRESS_LIST= (ADDRESS = (PROTOCOL=TCP)(HOST=jfdb)(PORT=1521)) (ADDRESS = (PROTOCOL=TCP)(HOST=jfdb)(PORT=1522))))" db_name = "PROD" pga_aggregate_target = 200M

2、启动实例
sys@PROD> startup pfile='/tmp/pfile.ora' nomount; ORACLE instance started. Total System Global Area 939495424 bytes Fixed Size 2233960 bytes Variable Size 251660696 bytes Database Buffers 679477248 bytes Redo Buffers 6123520 bytes sys@PROD> create spfile from pfile='/tmp/pfile.ora'; File created.
Copy after login
3、开始还原数据文件
oracle@jfdb arch]$ cd /backup
[oracle@jfdb backup]$ ll
total 1664052
-rw-r-----. 1 oracle oinstall 340795392 Jun  8 06:01 sysaux01.dbf
-rw-r-----. 1 oracle oinstall 524296192 Jun  8 06:01 system01.dbf
-rw-r-----. 1 oracle oinstall 524296192 Jun  8 06:01 tp01.dbf
-rw-r-----. 1 oracle oinstall 209723392 Jun  8 06:01 undotbs01.dbf
-rw-r-----. 1 oracle oinstall 104865792 Jun  8 06:02 users01.dbf
[oracle@jfdb backup]$ cp * -rf /u01/app/oracle/oradata/PROD
Copy after login

4、查数据库字符集

select distinct dbms_rowid.rowid_block_number(rowid) from props$;
DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)
------------------------------------
                                 801
[oracle@jfdb PROD]$ dd if=system01.dbf of=guoyJoe bs=8192 skip=801 count=1

1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.000159113 s, 51.5 MB/s
[oracle@jfdb PROD]$ strings guoyJoe
NO_USERID_VERIFIER_SALT 0438054C4F979EC5A5F74990346F5327,
WORKLOAD_REPLAY_MODE
bPREPARE implies external replay clients can connect; REPLAY implies workload replay is in progress,
WORKLOAD_CAPTURE_MODE
/CAPTURE implies workload capture is in progress,
EXPORT_VIEWS_VERSION
Export views revision #,
DEFAULT_PERMANENT_TABLESPACE
USERS$Name of default permanent tablespace,
GLOBAL_DB_NAME
PROD
Global database name,
NLS_RDBMS_VERSION
11.2.0.3.0 RDBMS version for NLS parameters,
NLS_NCHAR_CHARACTERSET  AL16UTF16
NCHAR Character set,
NLS_NCHAR_CONV_EXCP
FALSE
NLS conversion exception,
NLS_LENGTH_SEMANTICS
BYTE
NLS length semantics,
NLS_COMP
BINARY
NLS comparison,
NLS_DUAL_CURRENCY
Dual currency symbol,
NLS_TIMESTAMP_TZ_FORMAT
DD-MON-RR HH.MI.SSXFF AM TZR
Timestamp with timezone format,
NLS_TIME_TZ_FORMAT
HH.MI.SSXFF AM TZR
Time with timezone format,
NLS_TIMESTAMP_FORMAT
DD-MON-RR HH.MI.SSXFF AM
Time stamp format,
NLS_TIME_FORMAT
HH.MI.SSXFF AM
Time format,
NLS_SORT
BINARY
Linguistic definition,
NLS_DATE_LANGUAGE
AMERICAN
Date language,
NLS_DATE_FORMAT DD-MON-RR
Date format,
NLS_CALENDAR    GREGORIAN
Calendar system,
NLS_CHARACTERSET
ZHS16GBK
Character set,
NLS_NUMERIC_CHARACTERS
Numeric characters,
NLS_ISO_CURRENCY
AMERICA
ISO currency,
NLS_CURRENCY
Local currency,
NLS_TERRITORY
AMERICA Territory,
NLS_LANGUAGE
AMERICAN
Language,
DEFAULT_TBS_TYPE        SMALLFILE
Default tablespace type,
DST_SECONDARY_TT_VERSION
0'Version of secondary timezone data file,
DST_PRIMARY_TT_VERSION
14%Version of primary timezone data file,
DST_UPGRADE_STATE
NONE&State of Day Light Saving Time Upgrade,
DBTIMEZONE
+08:00
DB time zone,
TDE_MASTER_KEY_ID,
Flashback Timestamp TimeZone
GMT"Flashback timestamp created in GMT,
DEFAULT_EDITION
ORA$BASE$Name of the database default edition,
DEFAULT_PERMANENT_TABLESPACE
SYSTEM$Name of default permanent tablespace,
DEFAULT_TEMP_TABLESPACE
TEMPTS$Name of default temporary tablespace,
        DICT.BASE
2 dictionary base tables version #
Copy after login

5、创建控制文件

sys@PROD> CREATE CONTROLFILE REUSE DATABASE "PROD" RESETLOGS ARCHIVELOG
  2      MAXLOGFILES 32
  3      MAXLOGMEMBERS 2
  4      MAXDATAFILES 32
  5      MAXINSTANCES 1
  6      MAXLOGHISTORY 449
  7  LOGFILE
  8    GROUP 1 '/u01/app/oracle/oradata/PROD/redo01.log'  SIZE 50M,
  9    GROUP 2 '/u01/app/oracle/oradata/PROD/redo02.log'  SIZE 50M,
 10    GROUP 3 '/u01/app/oracle/oradata/PROD/redo03.log'  SIZE 50M
 11  DATAFILE
 12    '/u01/app/oracle/oradata/PROD/system01.dbf',
 13    '/u01/app/oracle/oradata/PROD/sysaux01.dbf',
 14    '/u01/app/oracle/oradata/PROD/undotbs01.dbf',
 15    '/u01/app/oracle/oradata/PROD/users01.dbf',
 16    '/u01/app/oracle/oradata/PROD/tp01.dbf'
 17  CHARACTER SET ZHS16GBK;

Control file created.
Copy after login
sys@PROD> select count(*) from v$archived_log;

  COUNT(*)
----------
         0
sys@PROD> alter database register physical logfile '/arch/1_134_842976958.dbf';

Database altered.

sys@PROD> alter database register physical logfile '/arch/1_135_842976958.dbf';

Database altered.

sys@PROD> alter database register physical logfile '/arch/1_136_842976958.dbf';

Database altered.

 sys@PROD> alter database register physical logfile '/arch/1_137_842976958.dbf';

Database altered.

sys@PROD> alter database register physical logfile '/arch/1_138_842976958.dbf';

Database altered.

sys@PROD> select count(*) from v$archived_log;

  COUNT(*)
----------
         5
Copy after login
sys@PROD> select file#,checkpoint_change# from v$datafile;

     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1            1658759
         2            1658739
         3            1658788
         4            1658802
         5            1658774

sys@PROD> select file#,checkpoint_change# from v$datafile_header;

     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1            1658759
         2            1658739
         3            1658788
         4            1658802
         5            1658774
Copy after login

8、开始不完全恢复

sys@PROD> recover database using backup controlfile until cancel;

ORA-00279: change 1658739 generated at 06/08/2014 06:01:29 needed for thread 1
ORA-00289: suggestion : /arch/1_134_842976958.dbf
ORA-00280: change 1658739 for thread 1 is in sequence #134


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00279: change 1658838 generated at 06/08/2014 06:02:46 needed for thread 1
ORA-00289: suggestion : /arch/1_135_842976958.dbf
ORA-00280: change 1658838 for thread 1 is in sequence #135
ORA-00278: log file &#39;/arch/1_134_842976958.dbf&#39; no longer needed for this recovery


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

ORA-00279: change 1658841 generated at 06/08/2014 06:02:47 needed for thread 1
ORA-00289: suggestion : /arch/1_136_842976958.dbf
ORA-00280: change 1658841 for thread 1 is in sequence #136
ORA-00278: log file &#39;/arch/1_135_842976958.dbf&#39; no longer needed for this recovery


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

ORA-00279: change 1658844 generated at 06/08/2014 06:02:50 needed for thread 1
ORA-00289: suggestion : /arch/1_137_842976958.dbf
ORA-00280: change 1658844 for thread 1 is in sequence #137
ORA-00278: log file &#39;/arch/1_136_842976958.dbf&#39; no longer needed for this recovery


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

ORA-00279: change 1658856 generated at 06/08/2014 06:03:17 needed for thread 1
ORA-00289: suggestion : /arch/1_138_842976958.dbf
ORA-00280: change 1658856 for thread 1 is in sequence #138
ORA-00278: log file &#39;/arch/1_137_842976958.dbf&#39; no longer needed for this recovery


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

ORA-00279: change 1658859 generated at 06/08/2014 06:03:21 needed for thread 1
ORA-00289: suggestion : /arch/1_139_842976958.dbf
ORA-00280: change 1658859 for thread 1 is in sequence #139
ORA-00278: log file &#39;/arch/1_138_842976958.dbf&#39; no longer needed for this recovery


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
Copy after login

9、再次查看数据文件头的检查点与控制文件的检查点是否一致

sys@PROD> select file#,checkpoint_change# from v$datafile;

     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1            1658859
         2            1658859
         3            1658859
         4            1658859
         5            1658859

sys@PROD> select file#,checkpoint_change# from v$datafile_header;

     FILE# CHECKPOINT_CHANGE#
---------- ------------------
         1            1658859
         2            1658859
         3            1658859
         4            1658859
         5            1658859
Copy after login

10、用resetlogs打开数据库

sys@PROD> alter database open resetlogs;

Database altered.

#########恢复完成
Copy after login
Statement of this Website
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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to transfer files from Quark Cloud Disk to Baidu Cloud Disk? How to transfer files from Quark Cloud Disk to Baidu Cloud Disk? Mar 14, 2024 pm 02:07 PM

Quark Netdisk and Baidu Netdisk are currently the most commonly used Netdisk software for storing files. If you want to save the files in Quark Netdisk to Baidu Netdisk, how do you do it? In this issue, the editor has compiled the tutorial steps for transferring files from Quark Network Disk computer to Baidu Network Disk. Let’s take a look at how to operate it. How to save Quark network disk files to Baidu network disk? To transfer files from Quark Network Disk to Baidu Network Disk, you first need to download the required files from Quark Network Disk, then select the target folder in the Baidu Network Disk client and open it. Then, drag and drop the files downloaded from Quark Cloud Disk into the folder opened by the Baidu Cloud Disk client, or use the upload function to add the files to Baidu Cloud Disk. Make sure to check whether the file was successfully transferred in Baidu Cloud Disk after the upload is completed. That's it

What to do if the 0x80004005 error code appears. The editor will teach you how to solve the 0x80004005 error code. What to do if the 0x80004005 error code appears. The editor will teach you how to solve the 0x80004005 error code. Mar 21, 2024 pm 09:17 PM

When deleting or decompressing a folder on your computer, sometimes a prompt dialog box &quot;Error 0x80004005: Unspecified Error&quot; will pop up. How should you solve this situation? There are actually many reasons why the error code 0x80004005 is prompted, but most of them are caused by viruses. We can re-register the dll to solve the problem. Below, the editor will explain to you the experience of handling the 0x80004005 error code. Some users are prompted with error code 0X80004005 when using their computers. The 0x80004005 error is mainly caused by the computer not correctly registering certain dynamic link library files, or by a firewall that does not allow HTTPS connections between the computer and the Internet. So how about

What is hiberfil.sys file? Can hiberfil.sys be deleted? What is hiberfil.sys file? Can hiberfil.sys be deleted? Mar 15, 2024 am 09:49 AM

Recently, many netizens have asked the editor, what is the file hiberfil.sys? Can hiberfil.sys take up a lot of C drive space and be deleted? The editor can tell you that the hiberfil.sys file can be deleted. Let’s take a look at the details below. hiberfil.sys is a hidden file in the Windows system and also a system hibernation file. It is usually stored in the root directory of the C drive, and its size is equivalent to the size of the system's installed memory. This file is used when the computer is hibernated and contains the memory data of the current system so that it can be quickly restored to the previous state during recovery. Since its size is equal to the memory capacity, it may take up a larger amount of hard drive space. hiber

Different uses of slashes and backslashes in file paths Different uses of slashes and backslashes in file paths Feb 26, 2024 pm 04:36 PM

A file path is a string used by the operating system to identify and locate a file or folder. In file paths, there are two common symbols separating paths, namely forward slash (/) and backslash (). These two symbols have different uses and meanings in different operating systems. The forward slash (/) is a commonly used path separator in Unix and Linux systems. On these systems, file paths start from the root directory (/) and are separated by forward slashes between each directory. For example, the path /home/user/Docume

Detailed explanation of log viewing command in Linux system! Detailed explanation of log viewing command in Linux system! Mar 06, 2024 pm 03:55 PM

In Linux systems, you can use the following command to view the contents of the log file: tail command: The tail command is used to display the content at the end of the log file. It is a common command to view the latest log information. tail [option] [file name] Commonly used options include: -n: Specify the number of lines to be displayed, the default is 10 lines. -f: Monitor the file content in real time and automatically display the new content when the file is updated. Example: tail-n20logfile.txt#Display the last 20 lines of the logfile.txt file tail-flogfile.txt#Monitor the updated content of the logfile.txt file in real time head command: The head command is used to display the beginning of the log file

Control Center not working in iPhone: Fix Control Center not working in iPhone: Fix Apr 17, 2024 am 08:16 AM

Imagine an iPhone without a functioning Control Center. You can't, right? If the buttons on the Control Center don't work properly, you won't be able to use your iPhone properly. The main idea of ​​Control Center is to easily access certain features directly from anywhere on your phone. In this case, these solutions will help to resolve the issue on your phone. Fix 1 – Use a Cloth to Clean Your Phone Sometimes the upper part of the display gets dirty from regular use. This may cause the Control Center to not function properly. Step 1 – Take a soft, clean microfiber cloth and clean the top half of your iPhone screen. You can also use any screen cleaning solution. Step 2 – Make sure to remove any dust, oil, or anything else from your phone’s display. After clearing phone screen

C++ function parameter type safety check C++ function parameter type safety check Apr 19, 2024 pm 12:00 PM

C++ parameter type safety checking ensures that functions only accept values ​​of expected types through compile-time checks, run-time checks, and static assertions, preventing unexpected behavior and program crashes: Compile-time type checking: The compiler checks type compatibility. Runtime type checking: Use dynamic_cast to check type compatibility, and throw an exception if there is no match. Static assertion: Assert type conditions at compile time.

Detailed explanation of the role of .ibd files in MySQL and related precautions Detailed explanation of the role of .ibd files in MySQL and related precautions Mar 15, 2024 am 08:00 AM

Detailed explanation of the role of .ibd files in MySQL and related precautions MySQL is a popular relational database management system, and the data in the database is stored in different files. Among them, the .ibd file is a data file in the InnoDB storage engine, used to store data and indexes in tables. This article will provide a detailed analysis of the role of the .ibd file in MySQL and provide relevant code examples to help readers better understand. 1. The role of .ibd files: storing data: .ibd files are InnoDB storage

See all articles