cancel
Showing results for 
Search instead for 
Did you mean: 

log_dir and LOGARCHMETH1

Former Member
0 Kudos

Hello All,

I have Installed SAP System on June 30th.

On July 6th I changed the LOGARCHMETH1 value to a location in the Disk.

Immediately took a Offline Backup(as it is mandatory) and then started DB and SAP.

Now today, My log files look like this,

Contents of LOG_DIR:

#ls -ltr

total 1258752

-rw------- 1 db2smr dbsmradm 512 Jun 30 15:00 SQLLPATH.TAG

-rw------- 1 db2smr dbsmradm 67100672 Jul 6 12:14 S0000011.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 6 12:14 S0000010.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 6 12:14 S0000014.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 6 12:14 S0000013.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 6 12:14 S0000012.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 6 12:14 S0000016.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 6 12:14 S0000015.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 6 12:14 S0000018.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 6 12:14 S0000017.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 6 12:14 S0000019.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 6 17:01 S0000020.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 6 17:37 S0000021.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 6 18:02 S0000022.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 7 10:54 S0000023.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 8 09:53 S0000025.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 8 09:53 S0000024.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 8 09:53 S0000026.LOG

-rw------- 1 db2smr dbsmradm 12619776 Jul 8 11:22 S0000007.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 8 14:03 S0000008.LOG

-rw------- 1 db2smr dbsmradm 67100672 Jul 8 16:10 S0000009.LOG

Contents of LOGARCHMETH1

#cd /db2/archiveLog////

  1. ls -ltr

total 308640

-rw-rr 1 db2smr dbsmradm 410 Jul 6 16:50 chive

-rw-r----- 1 db2smr dbsmradm 12451840 Jul 6 17:01 S0000000.LOG

-rw-r----- 1 db2smr dbsmradm 11530240 Jul 6 17:26 S0000001.LOG

-rw-r----- 1 db2smr dbsmradm 10944512 Jul 6 18:02 S0000002.LOG

-rw-r----- 1 db2smr dbsmradm 11722752 Jul 6 19:07 S0000003.LOG

-rw-r----- 1 db2smr dbsmradm 67100672 Jul 7 15:04 S0000004.LOG

-rw-r----- 1 db2smr dbsmradm 67100672 Jul 7 17:09 S0000005.LOG

-rw-r----- 1 db2smr dbsmradm 55078912 Jul 7 19:39 S0000006.LOG

-rw-r----- 1 db2smr dbsmradm 12619776 Jul 8 11:22 S0000007.LOG

-rw-r----- 1 db2smr dbsmradm 67100672 Jul 8 14:03 S0000008.LOG

Now my questions is:

1. I will backup the Archive Logs from the dir LOGARCHMETH1. What do I do with the files of log_dir? Do they need to be backed up?

2. If answer to question 1 is NO, then active log file is in log_dir, will it be not required? can we ignore all the files in log_dir?

3. Incase of a disaster, say right now, while doing roll forward, will it ask for a log file that is present in log_dir but not in LOGARCHMETH1?

4. After switching on the parameter LOGARCHMETH1(on July 6th) it started the sequence of log files in that location from 0. But why the sequence of naming log files in log_dir got changed to 7 on Jul 8 11:22 ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

1. I will backup the Archive Logs from the dir LOGARCHMETH1. What do I do with the files of log_dir? Do they need to be backed up?

-- Log files under the log_dir need not be backed up. These are empty (or initialized) log files created by DB2 and do not have any relevant data. The database engine will move the log files to the LOGARCHMETH1 location once there is any data written to it. However these log files also include currently active logs (log files currently being written to by the database) and should never be deleted manually.

2. If answer to question 1 is NO, then active log file is in log_dir, will it be not required? can we ignore all the files in log_dir?

-- Yes, you can ignore the logs in the log_dir in terms of backup. However, these are active log files and should not be manually deleted. The only location from which you should delete log files is the logarchmeth1 location and only those log files that are NOT in the active log range (i.e. log files with numbers < First active log as shown in the db snapshot).

3. Incase of a disaster, say right now, while doing roll forward, will it ask for a log file that is present in log_dir but not in LOGARCHMETH1?

-- In my opinion that is possible if you have a hard crash of the database (i.e. the database doesnt get an opportunity to archive log files), however, provided you dont "delete" anything from the active log location, you will be fine. Thats because, after the rollforward is complete, all relevant log files will be archived to the LOGARCHMETH1 location.

4. After switching on the parameter LOGARCHMETH1(on July 6th) it started the sequence of log files in that location from 0. But why the sequence of naming log files in log_dir got changed to 7 on Jul 8 11:22 ?

-- You only see log files from #7 in the log_dir because log files prior to that number have been closed and archived (i.e. moved to the LOGARCHMETH1 location). Note that log numbers are always increasing in sequence and are unique for a given "log chain" (i.e. the C0000n directory you see in the LOGARCHMETH1 path). So, once, logs from #7 to #22 get used up, you will see a new sequence of #23 to #38 in your log_dir.

Hope that helps!

-Sameer

Former Member
0 Kudos

Thanks a lot Sameer for the detailed info.

One more ques.

If i switch OFF LOGARCHMETH1, it will stop archiving log files from log_dir to another location.

But how do i stop the geneartion of log files in log_dir? I want logging to be switched off.

Thanks!

Former Member
0 Kudos

You cannot disable logging completely (except for specific tables for a short duration by using not logged initially or LOAD). However, you can use circular logging instead of archival logging to avoid having to archive logs and also prevent logs from accumulating in the active log directory. This also means that you will loose the ability to do a point-in-time recovery and will only be able to do a version recovery. I believe SAP requires the database to have archival logging enabled and does not support circular logging..

- Sameer

Answers (0)