Tibero Backup & Recovery Guide

Similar documents
Tibero Migration Utility Guide

Tibero TSC Installation Guide

Oracle Database 10g Migration to Automatic Storage Management. An Oracle White Paper August 2005

Recovering Oracle Databases

Disaster Recovery: Restore Database from One Server to another Server when Different Location

RECO CKPT SMON ARCH PMON RMAN DBWR

LOSS OF FULL DATABASE AND DATABASE RECOVERY ORACLE 11g

Tablespaces and Datafiles

Tibero Client Installation Guide

9i RAC: Manual Backup and Recovery Shankar Govindan

Steps how to duplicate a database to a new machine. Version 10gR2

Tibero Object Usage Guide

Chapter One. Concepts BACKUP CONCEPTS

Using Recovery Manager with Oracle Data Guard in Oracle9i. An Oracle White Paper March 2004

These copies should be placed on different disks, if possible. Disk 1 Disk 2 Disk 3

Course Contents of ORACLE 9i

ASM migration process

Oracle RMAN for Absolute Beginners

Oracle Database 10g Migration to Automatic Storage Management. An Oracle White Paper August 2004

White Paper. Using SVA SnapShot With Oracle June, 2001 TL-ENG-PRD-0477-A1 TL-ENG-PRD-0477-A01

Implementation of Database Systems David Konopnicki Taub 715 Spring Sources

ActiveImage Protector 2016R2SP1. Backup and Recovery of Oracle Database Second Edition - March 23, 2017

Cloning an Oracle Database to the Same Server Using FlashCopy and VolumeCopy on DS3400, DS4000, and DS5000

Explore the Oracle 10g database architecture. Install software with the Oracle Universal Installer (OUI)

Performing a 32 bit to 64 bit migration using the Transportable Database RMAN feature

Actual4Test. Actual4test - actual test exam dumps-pass for IT exams

TestsDumps. Latest Test Dumps for IT Exam Certification

1-2 Copyright Ó Oracle Corporation, All rights reserved.

Oracle 1Z0-053 Exam Questions & Answers

Basics of SQL Transactions

Oracle 1Z Oracle Database 10g: Administration II. Download Full Version :

Imagination To Realization

Oracle Database 11g: Administration I

Managing an Oracle Instance

NEC istorage Series Disk Array Guide for Oracle Storage Compatibility Program Snapshot Technologies

ORACLE DBA TRAINING IN BANGALORE

CHAPTER. Planning and Managing Tablespaces

ORACLE 11gR2 DBA. by Mr. Akal Singh ( Oracle Certified Master ) COURSE CONTENT. INTRODUCTION to ORACLE

Data Guard: Setup and Administration. By Ashok Kapur Hawkeye Technology, Inc.

Recovery Manager Concepts

Oracle. Exam Questions 1Z Oracle Database 11g: Administration I. Version:Demo

DumpsKing. Latest exam dumps & reliable dumps VCE & valid certification king

Lesson 2 RMAN Architecture

A. Automatic memory management is disabled because PGA_AGGREGATE_TARGET and SGA_TARGET are not set.

Creating an Oracle Database

A. connecting to the target database and a recovery catalog to execute the duplicate command

EVault InfoStage 5.6 Oracle Plug-In for Solaris and Windows. Installation & Configuration Guide

Oracle Database 11g Data Guard

Oracle Exam 11gocmu Oracle Database 11g Certified Master Upgrade Exam Version: 4.0 [ Total Questions: 671 ]

Oracle 1Z0-052 Exam Questions and Answers (PDF) Oracle 1Z0-052 Exam Questions 1Z0-052 BrainDumps

Exam 1Z0-061 Oracle Database 12c: SQL Fundamentals

Managing Oracle Real Application Clusters. An Oracle White Paper January 2002

Projects. Corporate Trainer s Profile. CMM (Capability Maturity Model) level Project Standard:- TECHNOLOGIES

Oracle Database Administration

Chapter 14: Backing up the Oracle Database Tapies covered in this section. Backup Overview. How often should backups be performed?

MySQL Architecture and Components Guide

Introduction to Oracle

Introduction. Storage Failure Recovery Logging Undo Logging Redo Logging ARIES

Architecture. Architecture. Introduction to Oracle 10g Express Edition. Help

SQL*Plus. Backup and Recovery Concepts. Release 2(9.2) March 2002 Part No. A

Lab4 - Managing Database Storage Structures Using Enterprise Manager Database Express

Oracle Architectural Components

Oracle 1Z Oracle 9i: New Features for Administrators. Download Full Version :

Technical White Paper August Migrating to Oracle 11g Using Data Replicator Software with Transportable Tablespaces

Installing the Oracle Database Softwar

How to Recover the lost current control file, or the current control file is inconsistent with files that you need to recover??

Electronic Presentation

Tablespace Usage By Schema In Oracle 11g Query To Check Temp

The Oracle DBMS Architecture: A Technical Introduction

Question: 1 Identify three components of an Oracle instance for which you can change the size dynamically. (Choose three.)

Exam : Oracle 1Z0 043

Index. ALLOCATE AUXILIARY CHANNEL command, Page numbers ending in f refer to figures. Page numbers ending in t refer to tables.

"Charting the Course... Oracle 18c DBA I (5 Day) Course Summary

Insanity: doing the same thing over and over again and expecting different results. Nice Proverb

Databases Clone using ACFS. Infrastructure at your Service.

Standby Database. Release 7.3. Sajjad Masud Jasmin Nakic Brian Quigley Lawrence To. Center of Expertise Worldwide Customer Support Oracle Corporation

NTFS Recoverability. CS 537 Lecture 17 NTFS internals. NTFS On-Disk Structure

Arcserve Backup for Windows

"Charting the Course... Oracle 18c DBA I (3 Day) Course Summary

CLIENT TRANSPORT USING R3TRANS

1z z0-060 Upgrade to Oracle Database 12c

Oracle Database Upgrade, Migration & Transformation Tips & Techniques Chapter 5

ROLLBACK SEGMENTS. In this chapter, you will learn about: Rollback Segment Management Page 272

Backing up or Exporting Databases Using mysqldump

Internals of Active Dataguard. Saibabu Devabhaktuni

Oracle 1Z Oracle Database 11g- Administrator I. Download Full Version :

Oracle 1Z0-235 Exam Questions & Answers

Setting Up Oracle for Prime Fulfillment

LOGGING OR NOLOGGING THAT IS THE QUESTION. By: Francisco Munoz Alvarez

Create an Oracle8i Database in Windows

EVault Software Oracle Plug-In 5.6 for Solaris 6.5 for Windows. Installation & Configuration Guide

DEBUNKING THE MYTHS ABOUT REDO, UNDO, COMMIT AND ROLLBACK

Oracle.ActualTests.1Z0-023.v by.Ramon.151q

Notice the oratab file doesn t contain the new database name (BDEV). Add it to the file by using below command;

How To Apply Archive Logs Manually In Standby Database Using Rman

Data Guard Configuration And Operation

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

DATABASE DESIGN I - 1DL300

Agent for Oracle. Arcserve Backup for Windows r17.5

Recovery without Backup. All Data Lost?

Transcription:

Tibero Backup & Recovery Guide Copyright 2014 TIBERO Co., Ltd. All Rights Reserved.

Copyright Notice Copyright 2014 TIBERO Co., Ltd. All Rights Reserved. 5, Hwangsaeul-ro 329beon-gil, Bundang-gu, Seongnam-si, Gyeonggi-do, Korea Restricted Rights Legend All TIBERO Software (Tibero ) and documents are protected by copyright laws and international convention. TIBERO software and documents are made available under the terms of the TIBERO License Agreement and may only be used or copied in accordance with the terms of this agreement. No part of this document may be transmitted, copied, deployed, or reproduced in any form or by any means, electronic, mechanical, or optical, without the prior written consent of TIBERO Co., Ltd. Trademarks Tibero DB is a registered trademark of TIBERO Co., Ltd. Other products, titles or services may be registered trademarks of their respective companies. Document Information Document Name: Tibero Backup & Recovery Guide Document Created: 2014-01-15 Software Version: Tibero 5 Document Version: 2.1.1

Table of Contents About This Document... vii Chapter 1. Overview... 1 1.1. Basic Concept... 1 1.2. Major Terms... 1 Chapter 2. Backup... 3 2.1. Overview... 3 2.2. Backup Method... 4 2.2.1. Control File Backup... 4 2.2.2. Online Backup... 5 2.2.3. Offline Backup... 6 Chapter 3. Recovery (Single)... 9 3.1. Overview... 9 3.1.1. Crash Recovery... 9 3.1.2. Media Recovery... 10 3.2. Recovery Environment Configuration... 11 3.3. Recovery... 13 3.3.1. Control File Recovery... 13 3.3.2. Online Log File Recovery... 17 3.3.3. Temp Tablespace Recovery... 33 3.3.4. Data File Error Complete Recovery... 34 3.3.5. Data File Error Incomplete Recovery... 42 Chapter 4. Recovery (TAC)... 55 4.1. Overview... 55 4.2. How to Recover... 55 Appendix A. TAC Online Backup Single Configuration... 65 A.1. Environment Configuration... 65 A.2. How to Configure... 68 Tibero iii

List of Figures [Figure 2.1] Backup Target... 3 [Figure 2.2] Backup Types... 4 [Figure 3.1] Crash Recovery Step... 9 Tibero v

About This Document Intended Audience This guide describes how to back up and recover Tibero. Required Knowledge This guide describes how to back up and recover Tibero. To fully understand this guide, users must have an understanding of the following: Databases OS and system environments UNIX and Linux Document Scope This guide does not contain all the information needed for the actual application or operation of Tibero RDBMS. Refer to the corresponding guides for more information. About This Document vii

Conventions Convention <AaBbCc123> <Ctrl>+C [Button] Boldface " " (double quotes) 'Input Item' Hyperlink > +---- ---- Note Meaning Filename of a program or source code Hold the Control key and press C Button or Menu name Emphasis Reference to chapters or sections in the manual, or to other related documentation Description for an input item on the screen E-mail account, website, or a link to other chapters or sections Progress order of menus Files or directories exist below Files or directories do not exist below Reference or note [Figure 1.1] [Table 1.1] AaBbCc123 Figure name Table name Command, execution result, or example code { } [ ] Required argument Optional argument viii Tibero Backup & Recovery Guide

Chapter 1. Overview This chapter describes the basic concepts of backup and recovery. 1.1. Basic Concept The following describes the basic concepts of backup and recovery: Backup Backup is a process that protects the database from various errors. It increases MTBF (Mean Time Between Failure) and reduces MTTR (Mean Time To Recover). The administrator must operate the database in a state that minimizes losses and can be recovered when an error occurs to the system. It is recommended to perform a full backup of the database at least once a month or export the backup once a day. The administrator must set the backup policy and back up the minimum required data. It is also recommended to regularly verify the backup was completed successfully. Recovery Recovery is the process or mechanism used to maintain the system operation in the event of an error occurring in the system. 1.2. Major Terms TSN TSN is the database version or commitment version. TSN is generated when a transaction is committed and is used for data concurrency control, redo ordering, and recovery. Checkpoint Checkpoint is the process of recording all dirty (changed) blocks of memory onto a disk on a regular basis or at a user's request. Checkpoint also minimizes the log file volume, which is required for recovery. Chapter 1. Overview 1

When all Log Switches occur, if an instance is terminated with the NORMAL, POST_TX, or IMMEDIATE option, a checkpoint is generated (alter system checkpoint) manually at the user's request. The LGWR then writes the contents of the current log buffer to the Online Log file and marks the corresponding dirty buffer. Finally, DBWR receives this information and records all marked dirty buffers to the disk. Checkpoint means all changes in the Online Log file, which occurred before Checkpoint TSN, are recorded to the disk. Log Mode The following describes Log modes. NO ARCHIVE LOG The default log mode. Redo log files are rotated and used. If a log switch occurs, the previous log file is overwritten. Only the recent portions of transaction records can be used because old logs do not exist. If redo logs are overwritten, recovery is only possible through the last full backup (offline backup). Backup must be performed after the database shuts down because services are suspended during backup. ARCHIVE LOG In this log mode, redo log files cannot be used until LOGA (Log Archiver) completes the backup. Additionally, archived log files can be used for media recovery. This backup can be performed while the database is running. 2 Tibero Backup & Recovery Guide

Chapter 2. Backup This chapter describes the types of backups and how to perform each type. 2.1. Overview Logical Backup Backs up the logical units of the database, such as table, index, constraint, and sequence, using an export tool. Physical Backup Backs up the database component files, such as data files, control files, and archive log files, using the 'copy' command at the operating system level. [Figure 2.1] Backup Target The NO ARCHIVE LOG mode and ARCHIVE LOG mode backup processes are different. NO ARCHIVE LOG Mode (Offline Backup / Cold Backup) Backs up all database component files when the database is down. The database can be recovered only to the time it was last backed up. ARCHIVE LOG Mode (Online Backup / Hot Backup) Backup can be performed while the database is running. The control file creation statement, data files, and archive log files can be backed up. Depending on when archive log file was backed up, recovery before the time of the backup is possible. Chapter 2. Backup 3

[Figure 2.2] Backup Types By each mode, consistent and inconsistent backup can be performed. Classification Consistent Backup Inconsistent Backup Description Backup after normal shutdown. Backup after abnormal shutdown or backup while the DB operates (it is recommended to use the ARCHIVE LOG mode). 2.2. Backup Method 2.2.1. Control File Backup The control file stores the database structure as a binary file. The control file is required when mounting the database. If the file does not exist, it must be recovered or be recreated. It is recommended to make two or more control files when configuring the database and to save the files on different disks. Use the following dynamic view to check the control file locations and whether the control file is multiplexed. v$controlfile Backup Process The following describes how to back up the control files. Control File Multiplexing 1. Use the tbdown command to shut down the database. 2. Copy the control file to a different location. 3. Add a CONTROL_FILES parameter to the $TB_SID.tip file. 4 Tibero Backup & Recovery Guide

4. Start the database using the command tbboot. Creating a Control File Trace Copy the file to a different location using the O/S copy command and create the trace using the following syntax: SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE AS '<FILENAME>' REUSE NORESETLOGS; Item <FILENAME> REUSE RESETLOGS NORESETLOGS Description Sets the trace file name. (If the path is not set, the file is created in the directory defined in the DB_CREATE_FILE_DEST parameter in the $TB_SID.tip file) To use the existing file when backing up the control file creation statement, use the REUSE option. Ignores the existing log files and initializes logs. Keeps using the existing, valid log files. Note While control file multiplexing is not required, it is recommended to back up the control file before creating the control file trace. 2.2.2. Online Backup Online Backup is performed while Tibero is running. It backs up the data files of the tablespace using the ALTER DATABASE command. Online backup can only be used in the ARCHIVE LOG mode. Backup Process The following describes the online backup process. 1. Notify the database of the start of the online backup. SQL> ALTER TABLESPACE SYSTEM BEGIN BACKUP; Chapter 2. Backup 5

2. Check the current backup mode using the dynamic view (v$backup) as follows: SQL> select * from v$backup; FILE# STATUS CHANGE# TIME ---------- ---------- ---------- -------------------------------- 0 ACTIVE 21091 1 NOT ACTIVE 0 2 NOT ACTIVE 0 3 NOT ACTIVE 0 3. Copy the tablespace data files using an O/S command. SQL>!cp /home/tibero/tbdata/system001.dtf /home/tibero/tbdata_bak/system001.dtf 4. Notify the Tibero database of the end of the online backup. SQL> ALTER TABLESPACE SYSTEM END BACKUP; Caution During the online backup, because the volume of logs about the database changes is increasing, execute and end the process as quickly as possible. 2.2.3. Offline Backup Offline Backup is performed after Tibero shuts down. Offline backup backs up data files, log files, control files, and Tip files using the O/S copy command after Tibero shuts down. The file information to be backed up can be checked using the v$datafile and v$logfile views in MOUNT or OPEN mode. In ARCHIVE LOG mode, archive files also can be backed up. Backup Process The following describes the offline backup process. 1. Check the files to be backed up using the dynamic view (v$datafile) as follows: SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- 6 Tibero Backup & Recovery Guide

/home/tibero/tbdata/system001.dtf /home/tibero/tbdata/undo001.dtf /home/tibero/tbdata/usr001.dtf /home/tibero/tbdata/apm_ts.dtf 2. Check the log files to be backed up using the dynamic view (v$logfile) as follows: SQL> select group#, member from v$logfile; GROUP# MEMBER ---------- ---------------------------------------- 0 /home/tibero/tbdata/redo01.redo 1 /home/tibero/tbdata/redo11.redo 2 /home/tibero/tbdata/redo21.redo 3. Check the control files to be backed up using the dynamic view (v$controlfile) as follows: SQL> select name from v$controlfile; NAME -------------------------------------------------------------------------------- /home/tibero/tbdata/c1.ctl /home/tibero/tbdata/c2.ctl 4. Shut down Tibero using the tbdown command. $ tbdown 5. Copy the files to be backed up. $ cp /home/tibero/tbdata/*.dtf /home/tibero/tbdata_bak/ $ cp /home/tibero/tbdata/*.redo /home/tibero/tbdata_bak/ $ cp /home/tibero/tbdata/*.ctl /home/tibero/tbdata_bak/ Or $ cp /home/tibero/tbdata/*.* /home/tibero/tbdata_bak/ Chapter 2. Backup 7

Chapter 3. Recovery (Single) This chapter describes the recovery process and how to handle errors. 3.1. Overview Recovery is the process or mechanism used to maintain system operation in the event of an error in the system. The following describes recovery related jobs by boot process. NOMOUNT: Starts an instance Database can be created Control file can be recreated MOUNT: Open a control file Data file name can be changed Archive mode option can be activated or deactivated The entire database can be recovered OPEN: Open all files defined in the control file 3.1.1. Crash Recovery Crash Recovery performs automatically when Tibero starts up after the database abnormally terminated. Only online redo log files, online data files, and the current control file are used. Crash Recovery recovers data that has not been committed using the Undo tablespace. [Figure 3.1] Crash Recovery Step Chapter 3. Recovery (Single) 9

The following describes crash recovery features. The recovery job starts automatically so the database administrator does not need to apply logs manually to recover data. Uses Online logs (Redo logs) but not archive logs. Uses Roll-forward and Rollback of Redo. 3.1.2. Media Recovery Media Recovery is used when a Tibero component file suffers physical damage or when a Tibero component file does not work normally. Media Recovery must be performed when the data file version is different (when a backup data file is used due to data file damage), an Online Redo log file is damaged, data is lost due to user error, or an archive log file is lost. The following describes the features of media recovery. Media recovery is performed manually by the DBA command (ALTER DATABASE RECOVER...) Media recovery uses backup data files for recovery. The Redo record from the Redo log file or the archive log file applies. Media recovery is only possible in MOUNT mode. The media recovery types are as follows: Classification Complete Recovery Incomplete Recovery Description Uses all archive log files and Online log files to apply the most recent logs. Applies a portion of the log files or recovers to a specific point of time. Point-in-Time recovery Applies only a portion of the Redo record When performing an Incomplete Recovery, the database must start with reset log. For more information about reset logs, refer to "RESETLOGS". 10 Tibero Backup & Recovery Guide

Media recovery uses the following dynamic view:. V$RECOVER_FILE V$RECOVERY_FILE_STATUS V$LOGFILE V$CONTROLFILE V$LOG RESETLOGS If an incomplete recovery is performed, the database must start with resetlogs. Data files and Log files before the reset logs command are not compatible with those after reset logs has been executed. The backup files or log files before reset logs cannot be used to recover to a time point after reset logs. The files after reset logs also cannot be used to perform the incomplete recovery to a time point before reset logs. The following shows how to use RESET LOGS. $ tbboot t resetlogs Note It is recommended to perform a backup when the database starts using reset logs. 3.2. Recovery Environment Configuration The following describes how to configure a recovery environment: 1. Tibero parameter configuration DB_NAME=tibero LISTENER_PORT=38629 CONTROL_FILES="/home/tibero/tbdata/c1.ctl", "/home/tibero/tbdata/c2.ctl" DB_CREATE_FILE_DEST="/home/tibero/tbdata" LOG_ARCHIVE_DEST="/home/tibero/tbarch" #CERTIFICATE_FILE="/home/tibero/tibero5/config/svr_wallet/tibero.crt" #PRIVKEY_FILE="/home/tibero/tibero5/config/svr_wallet/tibero.key" #WALLET_FILE="/home/tibero/tibero5/config/svr_wallet/WALLET" MAX_SESSION_COUNT=10 TOTAL_SHM_SIZE=1024M Chapter 3. Recovery (Single) 11

2. Database creation CREATE DATABASE "tibero" USER SYS IDENTIFIED BY TIBERO MAXDATAFILES 4096 CHARACTER SET MSWIN949 LOGFILE GROUP 0 ('redo01.redo', 'redo02.redo') SIZE 50M, GROUP 1 ('redo11.redo', 'redo12.redo') SIZE 50M, GROUP 2 ('redo21.redo', 'redo22.redo') SIZE 50M MAXLOGFILES 100 MAXLOGMEMBERS 8 ARCHIVELOG DATAFILE 'system001.dtf' SIZE 256M AUTOEXTEND ON NEXT 16M MAXSIZE 3072M DEFAULT TABLESPACE USR DATAFILE 'usr001.dtf' SIZE 128M AUTOEXTEND ON NEXT 16M MAXSIZE 3072M DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE 'temp001.dtf' SIZE 512M AUTOEXTEND ON NEXT 16M MAXSIZE 10240M EXTENT MANAGEMENT LOCAL AUTOALLOCATE UNDO TABLESPACE UNDO DATAFILE 'undo001.dtf' SIZE 512M AUTOEXTEND ON NEXT 16M MAXSIZE 10240M EXTENT MANAGEMENT LOCAL AUTOALLOCATE; 3. Tablespace creation DROP TABLESPACE "MY_FILE001" INCLUDING CONTENTS AND DATAFILES; CREATE TABLESPACE "MY_FILE001" DATAFILE 'my_file001.dtf' SIZE 10M AUTOEXTEND ON NEXT 1M MAXSIZE 3G EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M; 4. User creation DROP USER TIBERO CASCADE; CREATE USER tibero IDENTIFIED BY tmax DEFAULT TABLESPACE MY_FILE001; GRANT CONNECT, RESOURCE, DBA TO tibero; 12 Tibero Backup & Recovery Guide

3.3. Recovery 3.3.1. Control File Recovery This section describes how to recover the control file in various situations. When the control file is deleted If deleting a control file causes an error, recreate the control file using the backup control file creation statement. Error Occurrence $ tbboot $ tbsql sys/tibero SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE AS '/home/tibero/tbdata/ctl_backup.sql' REUSE NORESETLOGS; $ rm -f /home/tibero/tbdata/c1.ctl Solution $ tbdown Tibero instance terminated (NORMAL mode). $ tbboot listener port = 38629 change core dump dir to /home/tibero_td/tibero5/bin/prof ******************************************************** * Critical Warning: Raise svmode failed. The reason is * TBR-24003: Unable to read control file. * Current server mode is NOMOUNT. ******************************************************** Tibero 5 Tibero instance started suspended at NOMOUNT mode. $ tbsql sys/tibero Chapter 3. Recovery (Single) 13

tbsql 5 Connected to Tibero. SQL> @ctl_backup.sql Control File created. File finished. SQL> exit Disconnected. $ tbdown Tibero instance terminated (NORMAL mode). $ tbboot listener port = 38629 change core dump dir to /home/tibero/tibero5/bin/prof ******************************************************** * Critical Warning: Raise svmode failed. The reason is * TBR-1024: Database needs media recovery: media recovery required(/home/tibero/tbdata/system001.dtf). * Current server mode is MOUNT. ******************************************************** Tibero 5 Tibero instance started suspended at MOUNT mode. $ tbsql sys/tibero tbsql 5 Connected to Tibero. SQL> select * from v$recover_file; FILE# ONLINE ERROR CHANGE# TIME ---------- ------- ------------------------ -------------------------------- 0 ONLINE media recovery required 18144 2013/06/14 14 Tibero Backup & Recovery Guide

1 ONLINE media recovery required 18144 2013/06/14 2 ONLINE media recovery required 18144 2013/06/14 3 ONLINE media recovery required 18144 2013/06/14 4 ONLINE media recovery required 18144 2013/06/14 5 rows selected. SQL> alter database recover automatic database; Database altered. SQL> select * from v$recover_file; 0 row selected. SQL> exit Disconnected. $ tbdown Tibero instance terminated (NORMAL mode). $ tbboot listener port = 38629 change core dump dir to /home/tibero_td/tibero5/bin/prof Tibero 5 Tibero instance started up (NORMAL mode). $ tbsql sys/tibero tbsql 5 Connected to Tibero. --Create a Temp file by using a comment script part in the backed up control file SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/home/tibero/tbdata/temp001.dtf' 2 SIZE 512M REUSE AUTOEXTEND ON NEXT 16M MAXSIZE 10G; Tablespace 'TEMP' altered. SQL> exit Disconnected. Chapter 3. Recovery (Single) 15

Note When the control file is overwritten while Tibero is running, the above method can also be used. When a duplicate control file is deleted When the database is down, if a duplicate control files is deleted, recreate the deleted control file or change the parameter file content. Error Occurrence $ rm -f /home/tibero/tbdata/c1.ctl $ tbdown $ tbboot listener port = 38629 change core dump dir to /home/tibero/tibero5/bin/prof Tibero 5 Tibero instance started up (NORMAL mode). $ tail -10f trace.log 14:37:11.463590 [CLC][2] 06 tc_cf.c:160 control file read failed: '/home/tibero/tbdata/c1.ctl' (blkno=1) (No such file or directory) 14:37:11.463612 [CLC][2] 06 tc_cf.c:215 control file write failed: '/home/tibero/tbdata/c1.ctl' 14:37:12.563593 [CLC][2] 06 tc_cf.c:160 control file read failed: '/home/tibero/tbdata/c1.ctl' (blkno=1) (No such file or directory) 14:37:12.563617 [CLC][2] 06 tc_cf.c:215 control file write failed: '/home/tibero/tbdata/c1.ctl' 14:37:13.663593 [CLC][2] 06 tc_cf.c:160 control file read failed: '/home/tibero/tbdata/c1.ctl' (blkno=1) (No such file or directory) 14:37:13.663617 [CLC][2] 06 tc_cf.c:215 control file write failed: '/home/tibero/tbdata/c1.ctl' 14:37:14.763598 [CLC][2] 06 tc_cf.c:160 control file read failed: '/home/tibero/tbdata/c1.ctl' (blkno=1) (No such file or directory) 14:37:14.763623 [CLC][2] 06 tc_cf.c:215 control file write failed: '/home/tibero/tbdata/c1.ctl' 14:37:15.863591 [CLC][2] 06 tc_cf.c:160 control file read failed: '/home/tibero/tbdata/c1.ctl' (blkno=1) (No such file or directory) 14:37:15.863612 [CLC][2] 06 tc_cf.c:215 control file write failed: '/home/tibero/tbdata/c1.ctl' 14:37:16.963652 [CLC][2] 06 tc_cf.c:160 control file read failed: '/home/tibero/tbdata/c1.ctl' (blkno=1) (No such file or directory) 14:37:16.963697 [CLC][2] 06 tc_cf.c:215 control file write failed: 16 Tibero Backup & Recovery Guide

'/home/tibero/tbdata/c1.ctl' $ tbdown Solution $ cp /home/tibero/tbdata/c2.ctl /home/tibero/tbdata/c1.ctl $ tbboot 3.3.2. Online Log File Recovery If the Redo log is deleted, Tibero works as follows: When one or more Redo log file does not exist when booting The boot fails When Tibero is started and is running normally, if a Redo Log file is deleted If a Redo log file that has never been used after booting is deleted (file descriptor does not exist) If there is an available member file within the group, Tibero works normally after leaving messages in the Trace logs. If all members are deleted within the group, Tibero terminates while leaving error messages in the Trace logs. If a Redo log file that was used after booting is deleted (there is a file descriptor) Works normally. When a logmmember is deleted from an INACTIVE Mode log group When Tibero is running, if a log member is deleted from an INACTIVE mode log group, the member in error is deleted and recreated. Error Occurrence SQL> set line 200 SQL> col group# for 999 SQL> col member for a50 SQL> col SEQ# for 999 SQL> col MB for 999 SQL> select a.group#, a.member, b.bytes/1024/1024 "MB", b.archived "ARC", 2 b.sequence# "SEQ#", b.status Chapter 3. Recovery (Single) 17

3 from v$logfile a, v$log b 4 where a.group#=b.group# 5 order by 1; GROUP# MEMBER MB ARC SEQ# STATUS ------ -------------------------------------------------- ---- --- ---- -------- 0 /home/tibero/tbdata/redo01.redo 50 YES 3 INACTIVE 0 /home/tibero/tbdata/redo02.redo 50 YES 3 INACTIVE 1 /home/tibero/tbdata/redo11.redo 50 NO 4 CURRENT 1 /home/tibero/tbdata/redo12.redo 50 NO 4 CURRENT 2 /home/tibero/tbdata/redo21.redo 50 YES 2 INACTIVE 2 /home/tibero/tbdata/redo22.redo 50 YES 2 INACTIVE 6 rows selected. SQL>!rm -f /home/tibero/tbdata/redo01.redo SQL>!ls /home/tibero/tbdata/redo01.redo ls: /home/tibero/tbdata/redo01.redo: No such file or directory SQL> alter system switch logfile; SQL> / SQL> / SQL> / SQL> / SQL> set line 200 18 Tibero Backup & Recovery Guide

SQL> col group# for 999 SQL> col member for a50 SQL> col SEQ# for 999 SQL> col MB for 999 SQL> select a.group#, a.member, b.bytes/1024/1024 "MB", b.archived "ARC", 2 b.sequence# "SEQ#", b.status 3 from v$logfile a, v$log b 4 where a.group#=b.group# 5 order by 1; GROUP# MEMBER MB ARC SEQ# STATUS ------ -------------------------------------------------- ---- --- ---- -------- 0 /home/tibero/tbdata/redo01.redo 50 NO 9 CURRENT 0 /home/tibero/tbdata/redo02.redo 50 NO 9 CURRENT 1 /home/tibero/tbdata/redo11.redo 50 YES 7 INACTIVE 1 /home/tibero/tbdata/redo12.redo 50 YES 7 INACTIVE 2 /home/tibero/tbdata/redo21.redo 50 YES 8 INACTIVE 2 /home/tibero/tbdata/redo22.redo 50 YES 8 INACTIVE 6 rows selected. SQL>! $vi /home/tibero/tibero5/instance/tibero/log/dbmslog/dbms.log 21:04:37.949 [DDL][0] 18 Executing DDL: alter system switch logfile 21:04:38.459 [CLL][0] 4 LOGFILE SWITCHED. LF#1(seqno=4, blocks=769 next=0000.00003ae4) 21:04:38.900 [CLA][0] 5 LOG GROUP 1 (lsn=4) ARCHIVED. (/home/tibero/tbarch/log-t0-r14647-s4.arc) 21:04:41.759 [DDL][0] 18 Executing DDL: alter system switch logfile 21:04:41.815 [CLL][3] 4 Failed to read 1 log blocks LF#0(member=0, blkno=0) 21:04:42.008 [CLL][0] 4 LOGFILE SWITCHED. LF#2(seqno=5, blocks=0 next=0000.00003ae7) 21:04:42.341 [CLA][0] 5 LOG GROUP 2 (lsn=5) ARCHIVED. (/home/tibero/tbarch/log-t0-r14647-s5.arc) 21:04:43.339 [DDL][0] 18 Executing DDL: alter system switch logfile 21:04:43.469 [CLL][3] 4 Failed to read 1 log blocks LF#0(member=0, blkno=0) 21:04:43.633 [CLL][0] 4 LOGFILE SWITCHED. LF#0(seqno=6, blocks=0 next=0000.00003aea) Chapter 3. Recovery (Single) 19

21:04:43.633 [CLL][3] 5 Failed to read 1 log blocks LF#0(member=0, blkno=0) 21:04:43.900 [CLA][0] 5 LOG GROUP 0 (lsn=6) ARCHIVED. (/home/tibero/tbarch/log-t0-r14647-s6.arc) 21:04:44.855 [DDL][0] 18 Executing DDL: alter system switch logfile 21:04:45.150 [CLL][0] 4 LOGFILE SWITCHED. LF#1(seqno=7, blocks=0 next=0000.00003aec) 21:04:45.308 [CLA][0] 5 LOG GROUP 1 (lsn=7) ARCHIVED. (/home/tibero/tbarch/log-t0-r14647-s7.arc) 21:05:11.718 [DDL][0] 18 Executing DDL: alter system switch logfile 21:05:12.136 [CLL][3] 4 Failed to read 1 log blocks LF#0(member=0, blkno=0) 21:05:12.263 [CLL][0] 4 LOGFILE SWITCHED. LF#2(seqno=8, blocks=0 next=0000.00003af7) 21:05:12.447 [CLA][0] 5 LOG GROUP 2 (lsn=8) ARCHIVED. (/home/tibero/tbarch/log-t0-r14647-s8.arc) Solution $ tbsql sys/tibero tbsql 5 Connected to Tibero. SQL> alter system switch logfile; SQL> alter database drop logfile member '/home/tibero/tbdata/redo01.redo'; Database altered. SQL> alter database add logfile member '/home/tibero/tbdata/redo01.redo' to group 0; Database altered. SQL> alter system switch logfile; SQL> / SQL> / 20 Tibero Backup & Recovery Guide

SQL>! $vi /home/tibero/tibero5/instance/tibero/log/dbmslog/dbms.log 21:11:50.275 [DDL][0] 18 Executing DDL: alter database drop logfile member '/home/tibero/tbdata/redo01.redo' 21:11:50.461 [DDL][0] 18 Alter database type 1 succeeded. 21:12:30.098 [DDL][0] 18 Executing DDL: alter database add logfile member '/home/tibero/tbdata/redo01.redo' to group 0 21:12:33.007 [DDL][0] 18 Alter database type 1 succeeded. 21:12:57.959 [DDL][0] 18 Executing DDL: alter system switch logfile 21:12:58.238 [CLL][0] 4 LOGFILE SWITCHED. LF#1(seqno=10, blocks=6 next=0000.00003b96) 21:12:58.412 [CLA][0] 5 LOG GROUP 1 (lsn=10) ARCHIVED. (/home/tibero/tbarch/log-t0-r14647-s10.arc) 21:13:00.459 [DDL][0] 18 Executing DDL: alter system switch logfile 21:13:00.579 [CLL][0] 4 LOGFILE SWITCHED. LF#2(seqno=11, blocks=0 next=0000.00003b98) 21:13:01.095 [CLA][0] 5 LOG GROUP 2 (lsn=11) ARCHIVED. (/home/tibero/tbarch/log-t0-r14647-s11.arc) 21:13:03.693 [DDL][0] 18 Executing DDL: alter system switch logfile 21:13:03.937 [CLL][0] 4 LOGFILE SWITCHED. LF#0(seqno=12, blocks=0 next=0000.00003b9c) 21:13:04.137 [CLA][0] 5 LOG GROUP 0 (lsn=12) ARCHIVED. (/home/tibero/tbarch/log-t0-r14647-s12.arc) When an INACTIVE Mode log group is deleted When Tibero is running, if an INACTIVE mode log group is deleted, the log group in error is deleted and recreated. Error Occurrence $ tbsql sys/tibero tbsql 5 Connected to Tibero. SQL> set line 200 SQL> col group# for 999 SQL> col member for a50 SQL> col SEQ# for 999 SQL> col MB for 999 Chapter 3. Recovery (Single) 21

SQL> select a.group#, a.member, b.bytes/1024/1024 "MB", b.archived "ARC", 2 b.sequence# "SEQ#", b.status 3 from v$logfile a, v$log b 4 where a.group#=b.group# 5 order by 1; GROUP# MEMBER MB ARC SEQ# STATUS ------ -------------------------------------------------- ---- --- ---- -------- 0 /home/tibero/tbdata/redo01.redo 50 YES 1 INACTIVE 0 /home/tibero/tbdata/redo02.redo 50 YES 1 INACTIVE 1 /home/tibero/tbdata/redo11.redo 50 NO 2 CURRENT 1 /home/tibero/tbdata/redo12.redo 50 NO 2 CURRENT 2 /home/tibero/tbdata/redo21.redo 50 NO -1 UNUSED 2 /home/tibero/tbdata/redo22.redo 50 NO -1 UNUSED 6 rows selected. SQL>!rm -f /home/tibero/tbdata/redo01.redo SQL>!rm -f /home/tibero/tbdata/redo02.redo SQL>!ls /home/tibero/tbdata/redo01.redo ls: /home/tibero/tbdata/redo01.redo: No such file or directory SQL>!ls /home/tibero/tbdata/redo02.redo ls: /home/tibero/tbdata/redo02.redo: No such file or directory SQL> alter system switch logfile; SQL> / SQL> / SQL> exit Disconnected. 22 Tibero Backup & Recovery Guide

Solution $ tbsql sys/tibero tbsql 5 Connected to Tibero. SQL> alter database drop logfile group 0; Database altered. SQL> alter database add logfile group 0 2 ('/home/tibero/tbdata/redo01.redo', '/home/tibero/tbdata/redo02.redo') 3 size 50M; Database altered. SQL> set line 200 SQL> col group# for 999 SQL> col member for a50 SQL> col SEQ# for 999 SQL> col MB for 999 SQL> select a.group#, a.member, b.bytes/1024/1024 "MB", b.archived "ARC", 2 b.sequence# "SEQ#", b.status 3 from v$logfile a, v$log b 4 where a.group#=b.group# 5 order by 1; GROUP# MEMBER MB ARC SEQ# STATUS ------ -------------------------------------------------- ---- --- ---- -------- 0 /home/tibero/tbdata/redo01.redo 50 NO -1 UNUSED 0 /home/tibero/tbdata/redo02.redo 50 NO -1 UNUSED 1 /home/tibero/tbdata/redo11.redo 50 NO 5 CURRENT 1 /home/tibero/tbdata/redo12.redo 50 NO 5 CURRENT 2 /home/tibero/tbdata/redo21.redo 50 YES 3 INACTIVE 2 /home/tibero/tbdata/redo22.redo 50 YES 3 Chapter 3. Recovery (Single) 23

INACTIVE 6 rows selected. When Tibero is terminated with the abort option after the CURRENT Mode log group is deleted When Tibero is running in ARCHIVE LOG mode, if a CURRENT mode log group is deleted and Tibero is terminated using the abort option, incomplete recovery must be performed using the TSN of a specific point of time. Perform the change-based recovery using the NEXT_TSN information of the last archive log file. Check the next_tsn information through v$archive_dest_files or by generating an archive file dump. When performing change-based recovery, use the next_tsn -1 value. Error Occurrence $ tbsql sys/tibero tbsql 5 Connected to Tibero. SQL> set line 200 SQL> col group# for 999 SQL> col member for a50 SQL> col SEQ# for 999 SQL> col MB for 999 SQL> select a.group#, a.member, b.bytes/1024/1024 "MB", b.archived "ARC", 2 b.sequence# "SEQ#", b.status 3 from v$logfile a, v$log b 4 where a.group#=b.group# 5 order by 1; GROUP# MEMBER MB ARC SEQ# STATUS ------ --------------------------------------------- ---- --- ---- -------- 0 /home/tibero/tbdata/redo01.redo 50 NO 7 CURRENT 0 /home/tibero/tbdata/redo02.redo 50 NO 7 CURRENT 1 /home/tibero/tbdata/redo11.redo 50 YES 5 INACTIVE 24 Tibero Backup & Recovery Guide

1 /home/tibero/tbdata/redo12.redo 50 YES 5 INACTIVE 2 /home/tibero/tbdata/redo21.redo 50 YES 6 INACTIVE 2 /home/tibero/tbdata/redo22.redo 50 YES 6 INACTIVE 6 rows selected. SQL> CREATE TABLE T1 (C1 VARCHAR(5)); Table 'T1' created. SQL> INSERT INTO T1 (C1) VALUES ('00011'); 1 row inserted. SQL> COMMIT; Commit completed. SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> INSERT INTO T1 (C1) VALUES ('00012'); 1 row inserted. SQL> COMMIT; Commit completed. SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> INSERT INTO T1 (C1) VALUES ('00013'); 1 row inserted. SQL> COMMIT; Commit completed. SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> INSERT INTO T1 (C1) VALUES ('00014'); 1 row inserted. SQL> COMMIT; Commit completed. SQL> set line 200 SQL> col group# for 999 SQL> col member for a50 Chapter 3. Recovery (Single) 25

SQL> col SEQ# for 999 SQL> col MB for 999 SQL> select a.group#, a.member, b.bytes/1024/1024 "MB", b.archived "ARC", 2 b.sequence# "SEQ#", b.status 3 from v$logfile a, v$log b 4 where a.group#=b.group# 5 order by 1; GROUP# MEMBER MB ARC SEQ# STATUS ------ --------------------------------------------- ---- --- ---- -------- 0 /home/tibero/tbdata/redo01.redo 50 NO 10 CURRENT 0 /home/tibero/tbdata/redo02.redo 50 NO 10 CURRENT 1 /home/tibero/tbdata/redo11.redo 50 YES 8 INACTIVE 1 /home/tibero/tbdata/redo12.redo 50 YES 8 INACTIVE 2 /home/tibero/tbdata/redo21.redo 50 YES 9 INACTIVE 2 /home/tibero/tbdata/redo22.redo 50 YES 9 INACTIVE 6 rows selected. SQL>!rm -f /home/tibero/tbdata/redo01.redo SQL>!rm -f /home/tibero/tbdata/redo02.redo SQL>!ls /home/tibero/tbdata/redo01.redo /home/tibero/tbdata/redo01.redo not found SQL>!ls /home/tibero/tbdata/redo02.redo /home/tibero/tbdata/redo02.redo not found SQL> exit Disconnected. $ tbdown abort Tibero instance terminated (ABORT mode). Solution $ cp /home/tibero/tbdata_bak/*.dtf /home/tibero/tbdata $ tbboot mount listener port = 38629 change core dump dir to /home/tibero/tibero5/bin/prof Tibero 5 26 Tibero Backup & Recovery Guide

Tibero instance started up (MOUNT mode). $ tbsql sys/tibero tbsql 5 Connected to Tibero. SQL> set line 200 SQL> col group# for 999 SQL> col member for a50 SQL> col SEQ# for 999 SQL> col MB for 999 SQL> select a.group#, a.member, b.bytes/1024/1024 "MB", b.archived "ARC", 2 b.sequence# "SEQ#", b.status 3 from v$logfile a, v$log b 4 where a.group#=b.group# 5 order by 1; GROUP# MEMBER MB ARC SEQ# STATUS ------ --------------------------------------------- ---- --- ---- -------- 0 /home/tibero/tbdata/redo01.redo 50 NO 10 CURRENT 0 /home/tibero/tbdata/redo02.redo 50 NO 10 CURRENT 1 /home/tibero/tbdata/redo11.redo 50 YES 8 INACTIVE 1 /home/tibero/tbdata/redo12.redo 50 YES 8 INACTIVE 2 /home/tibero/tbdata/redo21.redo 50 YES 9 INACTIVE 2 /home/tibero/tbdata/redo22.redo 50 YES 9 INACTIVE 6 rows selected. --Check the next_change# - 1 value SQL> set line 200 SQL> col name for a40 SQL> col SEQ# for 999 SQL> col TSN for 999999999 SQL> select name, sequence# seq#, next_change#-1 tsn 2 from v$archive_dest_files order by 2; NAME SEQ# TSN ----------------------------------------- ---- ---------- /home/tibero/tbdata/arch/log-t0-r0-s7.arc 7 45589 Chapter 3. Recovery (Single) 27

/home/tibero/tbdata/arch/log-t0-r0-s8.arc 8 45597 /home/tibero/tbdata/arch/log-t0-r0-s9.arc 9 45606 3 rows selected. --If the TSN information does not exist, generate a log file dump. SQL> alter system dump logfile '/home/tibero/tbdata/arch/log-t0-r0-s9.arc'; SQL> exit Disconnected. $ cd $TB_HOME/instance/$TB_SID/dump/tracedump $ ls -rlt total 24 -rw-r--r-- 1 tibero dba 2688 Jul 10 19:08 tb_dump_47120982_37_2.trc -- Change the next_tsn value to a decimal number: 0000.0000b227 (hex) => 45607 (dec) --next_tsn - 1 = 45606 $ grep next tb_dump_47120982_37_2.trc low=0000.0000b21e 2013-07-10 18:59:28 next=0000.0000b227 2013-07-10 18:59:43...(Omitted) $ tbsql sys/tibero tbsql 5 Connected to Tibero. SQL> alter database recover automatic database until change 45606; Database altered. SQL> exit Disconnected. $ tbdown Tibero instance terminated (NORMAL mode). $ tbboot resetlogs listener port = 38629 change core dump dir to /home/tibero/tibero5/bin/prof 28 Tibero Backup & Recovery Guide

Tibero 5 Tibero instance started up (NORMAL RESETLOGS mode). $ tbsql sys/tibero tbsql 5 Connected to Tibero. SQL> select * from t1; C1 ----- 00011 00012 00013 3 rows selected. When Tibero is terminated with the immediate option after deleting the CURRENT Mode log group When Tibero is running in ARCHIVE LOG mode, if the CURRENT mode log group is deleted and Tibero is terminated with the immediate option, the last committed data is terminated after being saved in the data files. Perform the recovery based on the cancellation. Error Occurrence $ tbsql sys/tibero tbsql 5 Connected to Tibero. SQL> CREATE TABLE T1 (C1 VARCHAR(5)); Table 'T1' created. SQL> INSERT INTO T1 (C1) VALUES ('00011'); 1 row inserted. SQL> COMMIT; Chapter 3. Recovery (Single) 29

Commit completed. SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> INSERT INTO T1 (C1) VALUES ('00012'); 1 row inserted. SQL> COMMIT; Commit completed. SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> INSERT INTO T1 (C1) VALUES ('00013'); 1 row inserted. SQL> COMMIT; Commit completed. SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> INSERT INTO T1 (C1) VALUES ('00014'); 1 row inserted. SQL> COMMIT; Commit completed. SQL> set line 200 SQL> col group# for 999 SQL> col member for a50 SQL> col SEQ# for 999 SQL> col MB for 999 SQL> select a.group#, a.member, b.bytes/1024/1024 "MB", b.archived "ARC", 2 b.sequence# "SEQ#", b.status 3 from v$logfile a, v$log b 4 where a.group#=b.group# 5 order by 1; GROUP# MEMBER MB ARC SEQ# STATUS ------ --------------------------------------------- ---- --- ---- -------- 0 /home/tibero/tbdata/redo01.redo 50 NO 7 CURRENT 0 /home/tibero/tbdata/redo02.redo 50 NO 7 CURRENT 30 Tibero Backup & Recovery Guide

1 /home/tibero/tbdata/redo11.redo 50 NO 5 INACTIVE 1 /home/tibero/tbdata/redo12.redo 50 NO 5 INACTIVE 2 /home/tibero/tbdata/redo21.redo 50 NO 6 INACTIVE 2 /home/tibero/tbdata/redo22.redo 50 NO 6 INACTIVE 3 rows selected. SQL>!rm -f /home/tibero/tbdata/redo01.redo SQL>!rm -f /home/tibero/tbdata/redo02.redo SQL>!ls /home/tibero/tbdata/redo01.redo /home/tibero/tbdata/redo01.redo not found SQL>!ls /home/tibero/tbdata/redo02.redo /home/tibero/tbdata/redo02.redo not found SQL> exit Disconnected. $ tbdown immediate Tibero instance terminated (IMMEDIATE mode). Solution $ tbboot listener port = 38629 change core dump dir to /home/tibero/tibero5/bin/prof ******************************************************** * Critical Warning: Raise svmode failed. The reason is * TBR-1042: Unable to read log member file in group 0, member -1 (), block 0. * Current server mode is MOUNT. ******************************************************** Tibero 5 Tibero instance started suspended at MOUNT mode. $ tbsql sys/tibero tbsql 5 Chapter 3. Recovery (Single) 31

Connected to Tibero. SQL> ALTER DATABASE RECOVER DATABASE UNTIL CANCEL; Database altered. SQL> exit Disconnected. $ tbdown Tibero instance terminated (NORMAL mode). $ tbboot resetlogs listener port = 38629 change core dump dir to /home/tibero/tibero5/bin/prof Tibero 5 Tibero instance started up (NORMAL RESETLOGS mode). $ tbsql sys/tibero tbsql 5 Connected to Tibero. SQL>!ls /home/tibero/tbdata/redo01.redo /home/tibero/tbdata/redo01.redo SQL>!ls /home/tibero/tbdata/redo02.redo /home/tibero/tbdata/redo02.redo SQL> set line 200 SQL> col group# for 999 SQL> col member for a50 SQL> col SEQ# for 999 SQL> col MB for 999 SQL> select a.group#, a.member, b.bytes/1024/1024 "MB", b.archived "ARC", 2 b.sequence# "SEQ#", b.status 3 from v$logfile a, v$log b 4 where a.group#=b.group# 5 order by 1; GROUP# MEMBER MB ARC SEQ# STATUS ------ -------------------------------------------------- ---- --- ---- 32 Tibero Backup & Recovery Guide

-------- 0 /home/tibero/tbdata/redo01.redo 50 NO 1 CURRENT 0 /home/tibero/tbdata/redo02.redo 50 NO 1 CURRENT 1 /home/tibero/tbdata/redo11.redo 50 NO -1 UNUSED 1 /home/tibero/tbdata/redo12.redo 50 NO -1 UNUSED 2 /home/tibero/tbdata/redo21.redo 50 NO -1 UNUSED 2 /home/tibero/tbdata/redo22.redo 50 NO -1 UNUSED 3 rows selected. SQL> select * from t1; C1 ----- 00011 00012 00013 00014 4 rows selected. 3.3.3. Temp Tablespace Recovery When the temp file is deleted When a temp tablespace file is deleted, the temp file is created automatically if tbboot is executed. Error Occurrence $ tbboot $ tbsql sys/tibero $ rm rf /home/tibero/tbdata/temp001.dtf Solution $ tbdown $ ls -al /home/tibero/tbdata/temp001.dtf ls: /home/tibero/tbdata/temp001.dtf: No such file or directory $ tbboot $ ls -al /home/tibero/tbdata/temp001.dtf -rw------- 1 tibero dba 536870912 Jun 24 17:25 /home/tibero/tbdata/temp001.dtf Chapter 3. Recovery (Single) 33

3.3.4. Data File Error Complete Recovery Automatic Complete Recovery When Tibero is running in ARCHIVE LOG mode, if data files are deleted, copy the backup data files and recover the files using the 'AUTOMATIC' command. Error Occurrence $ tbdown $ cp R /home/tibero/tbdata /home/tibero/tbdata_bak $ tbboot $ tbsql tibero/tmax SQL> CREATE TABLE T1 (C1 VARCHAR(5)) TABLESPACE MY_FILE001; Table 'T1' created. SQL> INSERT INTO T1 (C1) VALUES ('00011'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00012'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00013'); 1 row inserted. SQL> COMMIT; Commit completed. SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> / SQL> / SQL> exit $ tbdown $ rm f /home/tibero/tbdata/my_file001.dtf 34 Tibero Backup & Recovery Guide

Solution $ cp /home/tibero/tbdata_bak/*.dtf /home/tibero/tbdata $ tbboot mount $ tbsql sys/tibero tbsql 5 Connected to Tibero. SQL> ALTER DATABASE RECOVER AUTOMATIC; Database altered. SQL> exit Disconnected. $ tbdown Tibero instance terminated (NORMAL mode). $ tbboot listener port = 38629 change core dump dir to /home/tibero_td/tibero5/bin/prof Tibero 5 Tibero instance started up (NORMAL mode). $ tbsql tibero/tmax tbsql 5 Connected to Tibero. SQL> select * from t1; C1 ----- 00011 00012 00013 Chapter 3. Recovery (Single) 35

3 rows selected. User Complete Recovery When Tibero is running in ARCHIVE LOG mode, if data files are deleted, use the archive file to recover the data files that were created by the archive file. For the files not created by an archive file and are in the current state, use Redo files. Error Occurrence $ tbdown $ cp R /home/tibero/tbdata /home/tibero/tbdata_bak $ tbboot $ tbsql tibero/tmax SQL> CREATE TABLE T1 (C1 VARCHAR(5)) TABLESPACE MY_FILE001; Table 'T1' created. SQL> INSERT INTO T1 (C1) VALUES ('00011'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00012'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00013'); 1 row inserted. SQL> COMMIT; Commit completed. SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> / SQL> / SQL> exit $ tbdown $ rm f /home/tibero/tbdata/my_file001.dtf 36 Tibero Backup & Recovery Guide

Solution $ cp /home/tibero/tbdata_bak/*.dtf /home/tibero/tbdata $ tbboot mount $ tbsql sys/tibero tbsql 5 Connected to Tibero. SQL> ALTER DATABASE RECOVER; Database altered. SQL> ALTER DATABASE RECOVER LOGFILE '/home/tibero/tbarch/log-t0-r0-s1.arc'; Database altered. SQL> ALTER DATABASE RECOVER LOGFILE '/home/tibero/tbarch/log-t0-r0-s2.arc'; Database altered. SQL> ALTER DATABASE RECOVER LOGFILE '/home/tibero/tbarch/log-t0-r0-s3.arc'; Database altered. SQL> select * from v$log; THREAD# GROUP# SEQUENCE# BYTES MEMBERS ARCHIVED STATUS ---------- ---------- ---------- ---------- ---------- -------- -------- FIRST_CHANGE# FIRST_TIME ------------- -------------------------------- 0 0 4 52428800 2 NO CURRENT 14521 2013/06/24 0 1 2 52428800 2 YES INACTIVE 14516 2013/06/24 0 2 3 52428800 2 YES INACTIVE 14518 2013/06/24 3 rows selected. SQL> select * from v$logfile; GROUP# STATUS TYPE MEMBER ---------- ------- ------ ----------------------------------------- 0 ONLINE /home/tibero/tbdata/redo01.redo 0 ONLINE /home/tibero/tbdata/redo02.redo 1 ONLINE /home/tibero/tbdata/redo11.redo 1 ONLINE /home/tibero/tbdata/redo12.redo Chapter 3. Recovery (Single) 37

2 ONLINE /home/tibero/tbdata/redo21.redo 2 ONLINE /home/tibero/tbdata/redo22.redo 6 rows selected. SQL> ALTER DATABASE RECOVER LOGFILE '/home/tibero/tbdata/redo01.redo'; Database altered. SQL> exit Disconnected. [tibero_td@tbsvr tbarch]$ tbdown Tibero instance terminated (NORMAL mode). [tibero_td@tbsvr tbarch]$ tbboot listener port = 38629 change core dump dir to /home/tibero/tibero5/bin/prof Tibero 5 Tibero instance started up (NORMAL mode). [tibero_td@tbsvr tbarch]$ tbsql tibero/tmax tbsql 5 Connected to Tibero. SQL> select * from t1; C1 ----- 00011 00012 00013 3 rows selected. 38 Tibero Backup & Recovery Guide

Complete recovery when backup data files do not exist When Tibero is running in ARCHIVE LOG mode, if backup data files do not exist, create data files first and perform the complete recovery using the AUTOMATIC command. However, the archive files must exist from the time the data files were created. Error Occurrence $ tbdown $ cp R /home/tibero/tbdata /home/tibero/tbdata_bak $ tbboot $ tbsql tibero/tmax SQL> CREATE TABLE T1 (C1 VARCHAR(5)) TABLESPACE MY_FILE001; Table 'T1' created. SQL> INSERT INTO T1 (C1) VALUES ('00011'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00012'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00013'); 1 row inserted. SQL> COMMIT; Commit completed. SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> / SQL> / SQL> exit $ tbdown $ rm f /home/tibero/tbdata/my_file001.dtf Chapter 3. Recovery (Single) 39

Solution $ tbboot mount $ tbsql sys/tibero SQL> ALTER DATABASE CREATE DATAFILE '/home/tibero/tbdata/my_file001.dtf'; Database altered. SQL> ALTER DATABASE RECOVER AUTOMATIC; Database altered. SQL> exit $ tbdown $ tbboot $ tbsql tibero/tmax SQL> SELECT * FROM T1; C1 ----- 00011 00012 00013 3 rows selected. Complete recovery while Online when backup data files exist If there are backup data files and if a data file is deleted while Online, set the tablespace to Offline and perform partial recovery (corresponding tablespace). After recovery is complete, set the tablespace to Online. Error Occurrence $ tbdown $ cp R /home/tibero/tbdata /home/tibero/tbdata_bak $ tbboot $ tbsql tibero/tmax SQL> CREATE TABLE T1 (C1 VARCHAR(5)) TABLESPACE MY_FILE001; Table 'T1' created. SQL> INSERT INTO T1 (C1) VALUES ('00011'); 40 Tibero Backup & Recovery Guide

1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00012'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00013'); 1 row inserted. SQL> COMMIT; Commit completed. SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> / SQL> / SQL> exit Disconnected. $ rm f /home/tibero/tbdata/my_file001.dtf Solution $ tbsql sys/tibero tbsql 5 Connected to Tibero. SQL> alter tablespace MY_FILE001 offline immediate; Tablespace 'MY_FILE001' altered. SQL> exit Disconnected. $ cp /home/tibero/tbdata_bak/my_file001.dtf /home/tibero/tbdata $ tbsql sys/tibero tbsql 5 Chapter 3. Recovery (Single) 41

Connected to Tibero. SQL> alter database recover automatic tablespace MY_FILE001; Database altered. SQL> alter tablespace MY_FILE001 online; Tablespace 'MY_FILE001' altered. SQL> conn tibero/tmax Connected to Tibero. SQL> select * from t1; C1 ----- 00011 00012 00013 3 rows selected. 3.3.5. Data File Error Incomplete Recovery If a corrupt block error occurs, apply "alter system set _enable_mr_corrupt_recovery=y " or register the parameter in the $TB_SID.tip file and restart. Change-based (TSN) Incomplete Recovery alter database recover automatic database until change 15666 allow <BLOCK number> corruption; Time-based Incomplete Recovery alter database recover automatic database until time '2013/06/13 15:58:50' allow <BLOCK number> corruption; Cancel-based Incomplete Recovery alter database recover until cancel allow <BLOCK number> corruption; 42 Tibero Backup & Recovery Guide

Note For cancel-based recovery, if DPL/DPI or nologging data is included, a log block corruption may occur. It is recommended to perform full backup after recovery. Change-Based (TSN) Incomplete Recovery When Tibero is running in ARCHIVE LOG mode, if data files are deleted, perform change-based incomplete recovery using the TSN of a specific point of time. Perform the change-based recovery using the NEXT_TSN information of the last archive log file. Check the next_tsn information through v$archive_dest_files or by generating an archive file dump. When performing change-based recovery, use the next_tsn -1 value. Error Occurrence $ tbdown $ cp R /home/tibero/tbdata /home/tibero/tbdata_bak $ tbboot $ tbsql sys/tibero SQL> SELECT * FROM V$LOG; THREAD# GROUP# SEQUENCE# BYTES MEMBERS ARCHIVED STATUS ---------- ---------- ---------- ---------- ---------- -------- -------- FIRST_CHANGE# FIRST_TIME ------------- -------------------------------- 0 0 1 52428800 2 YES INACTIVE 0 0 1 2 52428800 2 NO CURRENT 15543 2013/06/14 0 2-1 52428800 2 NO UNUSED 0 3 rows selected. SQL> CREATE TABLE T1 (C1 VARCHAR(5)); Table 'T1' created. SQL> INSERT INTO T1 (C1) VALUES ('00011'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00012'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00013'); 1 row inserted. Chapter 3. Recovery (Single) 43

SQL> COMMIT; Commit completed. SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> INSERT INTO T1 (C1) VALUES ('00021'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00022'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00023'); 1 row inserted. SQL> COMMIT; Commit completed. SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> INSERT INTO T1 (C1) VALUES ('00031'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00032'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00033'); 1 row inserted. SQL> COMMIT; Commit completed. SQL> ALTER SYSTEM SWITCH LOGFILE; SQL> INSERT INTO T1 (C1) VALUES ('00041'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00042'); 1 row inserted. SQL> INSERT INTO T1 (C1) VALUES ('00043'); 1 row inserted. SQL> COMMIT; 44 Tibero Backup & Recovery Guide

Commit completed. SQL> exit Disconnected. $ tbdown Tibero instance terminated (NORMAL mode). $ rm /home/tibero/tbdata/*.dtf $ tbboot listener port = 38629 change core dump dir to /home/tibero/tibero5/bin/prof ******************************************************** * Critical Warning: Raise svmode failed. The reason is * TBR-1024: Database needs media recovery: open failed(/home/tibero/tbdata/system001.dtf). * Current server mode is MOUNT. ******************************************************** Tibero 5 Tibero instance started suspended at MOUNT mode. Solution $ tbdown Tibero instance terminated (NORMAL mode). $ cp /home/tibero/tbdata_bak/*.dtf /home/tibero/tbdata $ tbboot mount listener port = 38629 change core dump dir to /home/tibero/tibero5/bin/prof Tibero 5 Tibero instance started up (MOUNT mode). $ tbsql sys/tibero Chapter 3. Recovery (Single) 45

tbsql 5 Connected to Tibero. SQL> SELECT * FROM V$LOG; THREAD# GROUP# SEQUENCE# BYTES MEMBERS ARCHIVED STATUS ---------- ---------- ---------- ---------- ---------- -------- -------- FIRST_CHANGE# FIRST_TIME ------------- -------------------------------- 0 0 4 52428800 2 YES INACTIVE 15652 2013/06/14 0 1 5 52428800 2 NO CURRENT 15667 2013/06/14 0 2 3 52428800 2 YES INACTIVE 15619 2013/06/14 3 rows selected. --Check the next_change# - 1 value SQL> set line 200 SQL> col name for a40 SQL> col SEQ# for 999 SQL> col TSN for 999999999 SQL> select name, sequence# seq#, next_change#-1 tsn 2 from v$archive_dest_files order by 2; NAME SEQ# TSN ---------------------------------------- ---- ---------- /home/tibero/tbarch/log-t0-r0-s1.arc 1 15542 /home/tibero/tbarch/log-t0-r0-s2.arc 2 15618 /home/tibero/tbarch/log-t0-r0-s3.arc 3 15651 /home/tibero/tbarch/log-t0-r0-s4.arc 4 15666 4 rows selected. --When the TSN informaiton does not exist, generate a Log file dump. SQL> alter system dump logfile '/home/tibero/tbarch/log-t0-r0-s4.arc'; SQL> exit Disconnected. $ cd $TB_HOME/instance/$TB_SID/dump/tracedump $ ls -rlt 46 Tibero Backup & Recovery Guide