非归档下oracle的备份和恢复
数据库处于非归档状态,其联机日志循环覆盖使用,这意味着如果数据库需要进行介质恢复应用相关归档,又由于非归档导致归档文件不存在,那么此时数据库只能执行..
数据库处于非归档状态,其联机日志循环覆盖使用,这意味着如果数据库需要进行介质恢复应用相关归档,又由于非归档导致归档文件不存在,那么此时数据库只能执行基于取消的恢复,回退整个数据库到上一次全备份状态。或者修改数据文件头部信息,来规避缺失归档。但不管怎么样都会丢失数据。
下面介绍非归档模式下几种常见故障处理方法。
一 非归档下的常用备份和恢复方法:
如何备份
Backing Up a Database in NOARCHIVELOG Mode You can only backup a database in NOARCHIVELOG mode when the database is closed and in a consistent state.
1 shutdown immediate
2 startup mount
3 backup database
如何恢复
注意 和归档模式下的恢复有如下不同点:
1 Only consistent backups can be used in restoring a database in NOARCHIVELOG mode.
2 Media recovery is not possible because no archived redo logs exist.
恢复步骤如下:
1 startup force mount;
2 restore database;
3 recover database until cancel;
4 alter database open resetlogs;
举例如下:
备份
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /oracle/archive
Oldest online log sequence 1
Current log sequence 2
RMAN> shutdown immediate;
using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down
RMAN> startup mount;
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 1252663296 bytes
Fixed Size 2226072 bytes
Variable Size 1006635112 bytes
Database Buffers 234881024 bytes
Redo Buffers 8921088 bytes
RMAN> backup database;
Starting backup at 2013-02-03 13:26:36
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=129 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/backup/users01.dbf
input datafile file number=00003 name=/oracle/CRM/undotbs3.dbf
input datafile file number=00006 name=/oracle/CRM/erp.dbf
input datafile file number=00007 name=/oracle/CRM/user01.dbf
channel ORA_DISK_1: starting piece 1 at 2013-02-03 13:26:38
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/CRM/system01.dbf
input datafile file number=00002 name=/oracle/CRM/sysaux01.dbf
input datafile file number=00005 name=/oracle/CRM/pos.dbf
channel ORA_DISK_2: starting piece 1 at 2013-02-03 13:26:39
channel ORA_DISK_1: finished piece 1 at 2013-02-03 13:29:36
piece handle=/backup/20130203_fro11v4d_1_1 tag=TAG20130203T132637 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:59
channel ORA_DISK_2: finished piece 1 at 2013-02-03 13:29:38
piece handle=/backup/20130203_fso11v4e_1_1 tag=TAG20130203T132637 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:02:59
Finished backup at 2013-02-03 13:29:38
Starting Control File and SPFILE Autobackup at 2013-02-03 13:29:38
piece handle=/backup/c-3599153036-20130203-00 comment=NONE
Finished Control File and SPFILE Autobackup at 2013-02-03 13:29:41
恢复
RMAN> startup force mount;
Oracle instance started
database mounted
Total System Global Area 1252663296 bytes
Fixed Size 2226072 bytes
Variable Size 1006635112 bytes
Database Buffers 234881024 bytes
Redo Buffers 8921088 bytes
RMAN> restore database;
Starting restore at 2013-02-03 16:13:04
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=129 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00003 to /oracle/CRM/undotbs3.dbf
channel ORA_DISK_1: restoring datafile 00004 to /backup/users01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /oracle/CRM/erp.dbf
channel ORA_DISK_1: restoring datafile 00007 to /oracle/CRM/user01.dbf
channel ORA_DISK_1: reading from backup piece /backup/20130203_fro11v4d_1_1
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00001 to /oracle/CRM/system01.dbf
channel ORA_DISK_2: restoring datafile 00002 to /oracle/CRM/sysaux01.dbf
channel ORA_DISK_2: restoring datafile 00005 to /oracle/CRM/pos.dbf
channel ORA_DISK_2: reading from backup piece /backup/20130203_fso11v4e_1_1
channel ORA_DISK_1: piece handle=/backup/20130203_fro11v4d_1_1 tag=TAG20130203T132637
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:04:09
channel ORA_DISK_2: piece handle=/backup/20130203_fso11v4e_1_1 tag=TAG20130203T132637
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:04:11
Finished restore at 2013-02-03 16:17:17
RMAN> host;
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Sun Feb 3 16:27:12 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> recover database until cancel;
ORA-00279: change 2942346 generated at 02/03/2013 13:26:11 needed for thread 1
ORA-00289: suggestion : /oracle/archive/1_2_806264057.dbf
ORA-00280: change 2942346 for thread 1 is in sequence #2
Specify log: {
cancel
Media recovery cancelled.
SQL> alter database open resetlogs;
Database altered.
SQL> select group#,archived,sequence#,status from v$Log;
GROUP# ARC SEQUENCE# STATUS
---------- --- ---------- ----------------
1 NO 1 CURRENT
2 YES 0 UNUSED
3 YES 0 UNUSED
4 YES 0 UNUSED
二 非归档无备份,单个文件丢失造成数据库无法打开
第一种方法:
SQL> startup ;
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size 2226072 bytes
Variable Size 1006635112 bytes
Database Buffers 234881024 bytes
Redo Buffers 8921088 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: '/oracle/CRM/test.dbf'
SQL> alter database datafile 8 offline drop;
Database altered.
SQL> alter database open;
Database altered.
SQL> alter database create datafile '/oracle/CRM/test.dbf';
Database altered.
SQL> select hxfil,fhscn,fhrba_seq from x$kcvfh;
HXFIL FHSCN FHRBA_SEQ
---------- ---------------- ----------
1 3078640 37
2 3078640 37
3 3078640 37
4 3078640 37
5 3078640 37
6 3078640 37
7 3078640 37
8 3077425 31
8 rows selected.
SQL> select group#,archived,sequence#,status from v$log;
GROUP# ARC SEQUENCE# STATUS
---------- --- ---------- ----------------
1 NO 37 CURRENT
2 NO 34 INACTIVE
3 NO 35 INACTIVE
4 NO 36 INACTIVE
由于是非归档则31、32、33号归档丢失,完全恢复已经不可能,只能执行基于取消的恢复,回退整个数据库。
SQL> startup force mount;
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size 2226072 bytes
Variable Size 1006635112 bytes
Database Buffers 234881024 bytes
Redo Buffers 8921088 bytes
Database mounted.
SQL> recover database until cancel;
ORA-00279: change 3078640 generated at 02/20/2013 16:44:47 needed for thread 1
ORA-00289: suggestion : /oracle/archive/1_37_806501358.dbf
ORA-00280: change 3078640 for thread 1 is in sequence #37
Specify log: {
cancel
ORA-10879: error signaled in parallel recovery slave
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/oracle/CRM/system01.dbf
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/oracle/CRM/system01.dbf'
SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;
System altered.
SQL> startup force mount;
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size 2226072 bytes
Variable Size 1006635112 bytes
Database Buffers 234881024 bytes
Redo Buffers 8921088 bytes
Database mounted.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [2662], [0], [3078648], [0],
[3078665], [4194432], [], [], [], [], [], []
Process ID: 5678
Session ID: 191 Serial number: 3
这里通过重启规避ora-600 [2662]错误
SQL> startup;
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size 2226072 bytes
Variable Size 1006635112 bytes
Database Buffers 234881024 bytes
Redo Buffers 8921088 bytes
Database mounted.
Database opened.
第二种方法
SQL> startup
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size 2226072 bytes
Variable Size 1006635112 bytes
Database Buffers 234881024 bytes
Redo Buffers 8921088 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: '/oracle/CRM/test.dbf'
SQL> alter database create datafile '/oracle/CRM/test.dbf';
Database altered.
注意,当我们用 alter database create datafile 创建数据文件时,香港空间,数据文件头部scn以及rba.seq号均取自于该数据文件创建时控制文件中记录的scn和rba.seq号,如下:
DATA FILE #8:
name #14: /oracle/CRM/test.dbf
Creation Checkpointed at scn: 0x0000.002d4053 02/03/2013 17:02:59
thread:1 rba:(0x2.20d.10)
0x2d4053准换为10进制为2965587
rba:(0x2.20d.10)则表示seq号为2.块525.偏移量10
SQL> select hxfil,fhscn,fhrba_seq,fhrba_bno from x$kcvfh;
HXFIL FHSCN FHRBA_SEQ FHRBA_BNO
---------- ---------------- ---------- ----------

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











Oracle 데이터베이스 로그의 보존 기간은 다음을 포함한 로그 유형 및 구성에 따라 다릅니다. 재실행 로그: "LOG_ARCHIVE_DEST" 매개변수로 구성된 최대 크기에 의해 결정됩니다. 보관된 리두 로그: "DB_RECOVERY_FILE_DEST_SIZE" 매개변수로 구성된 최대 크기에 따라 결정됩니다. 온라인 리두 로그: 보관되지 않고 데이터베이스를 다시 시작하면 손실되며 보존 기간은 인스턴스 실행 시간과 일치합니다. 감사 로그: "AUDIT_TRAIL" 매개변수로 구성되며 기본적으로 30일 동안 보관됩니다.

Oracle 데이터베이스 시작 순서는 다음과 같습니다. 1. 전제 조건을 확인합니다. 3. 데이터베이스 인스턴스를 시작합니다. 5. 데이터베이스에 연결합니다. . 서비스를 활성화합니다(필요한 경우). 8. 연결을 테스트합니다.

Oracle에 필요한 메모리 양은 데이터베이스 크기, 활동 수준 및 필요한 성능 수준(데이터 버퍼 저장, 인덱스 버퍼, SQL 문 실행 및 데이터 사전 캐시 관리에 필요)에 따라 다릅니다. 정확한 양은 데이터베이스 크기, 활동 수준 및 필요한 성능 수준에 따라 달라집니다. 모범 사례에는 적절한 SGA 크기 설정, SGA 구성 요소 크기 조정, AMM 사용 및 메모리 사용량 모니터링이 포함됩니다.

Oracle에서 문자 발생 횟수를 찾으려면 다음 단계를 수행하십시오. 문자열의 전체 길이를 얻습니다. 문자가 나타나는 부분 문자열의 길이를 얻습니다. 부분 문자열 길이를 빼서 문자 발생 횟수를 계산합니다. 전체 길이에서.

Oracle 데이터베이스 서버 하드웨어 구성 요구 사항: 프로세서: 기본 주파수가 2.5GHz 이상인 멀티 코어, 대규모 데이터베이스의 경우 32개 이상의 코어가 권장됩니다. 메모리: 소규모 데이터베이스의 경우 최소 8GB, 중간 크기의 경우 16~64GB, 대규모 데이터베이스 또는 과도한 작업 부하의 경우 최대 512GB 이상. 스토리지: SSD 또는 NVMe 디스크, 중복성 및 성능을 위한 RAID 어레이. 네트워크: 고속 네트워크(10GbE 이상), 전용 네트워크 카드, 지연 시간이 짧은 네트워크. 기타: 안정적인 전원 공급 장치, 이중 구성 요소, 호환 가능한 운영 체제 및 소프트웨어, 열 방출 및 냉각 시스템.

Oracle은 다음 단계를 통해 dbf 파일을 읽을 수 있습니다. 외부 테이블을 만들고 dbf 파일을 참조하여 데이터를 Oracle 테이블로 가져옵니다.

Oracle 데이터베이스에 필요한 메모리 양은 데이터베이스 크기, 작업 부하 유형 및 동시 사용자 수에 따라 다릅니다. 일반 권장 사항: 소형 데이터베이스: 16~32GB, 중형 데이터베이스: 32~64GB, 대형 데이터베이스: 64GB 이상. 고려해야 할 다른 요소로는 데이터베이스 버전, 메모리 최적화 옵션, 가상화 및 모범 사례(메모리 사용량 모니터링, 할당 조정)가 있습니다.

Oracle에서 하루에 한 번 실행되는 예약된 작업을 생성하려면 다음 세 단계를 수행해야 합니다. 작업을 생성합니다. 작업에 하위 작업을 추가하고 해당 일정 표현식을 "INTERVAL 1 DAY"로 설정합니다. 작업을 활성화합니다.
