Wednesday, April 13, 2011

Techwave - Call for Conference Presentations!

from    Sybase TechWave 
date Thu, Apr 7, 2011 at 5:40 PM
subject Submit Your Session Idea Today


Have you used Sybase products to solve a business challenge, to increase your data’s mobility or to improve query speeds? If you have a solution you would like to share with your friends and colleagues, submit a session proposal for TechWave. Sessions should focus on the following topics: Data Management, Analytics, Development Tools, mCommerce, or Enterprise Mobility.

Sybase TechWave is September 12-16, in Las Vegas. Speakers must be available to present during the entire span of the conference. The deadline to submit a session for consideration is May 6. Acceptance notifications will be sent out in June.

Sessions need to be educational and technically focused. Please review the guidelines and examples provided on the session proposal website.

We offer complimentary registration to approved speakers. TechWave does not reimburse for speakers' time, travel, or hotel costs. If you are selected as a presenter, your final presentation is due July 31.

Be sure to bookmark the TechWave website, where all the latest information will be posted. And follow @SyTechWave on Twitter for conference updates.

Sincerely,
The Sybase TechWave Team


Important Dates
May 6
Session Proposals Due

July 31
Final Presentation Slides Due

Session Proposal Guidelines
Title – 75 characters
Abstract – 200 words
Speaker Bio – 250 characters
Must be detailed and
descriptive enough to catch
the interest of attendees

For additional information visit the
session proposal website.


Monday, April 11, 2011

Wishful Thinking: Monitoring Plans In Production

Updated November 25, 2013: This "April Fools' Day" article was originally published with the title "Monitoring Plans In Production". Sadly, it continues to show up in Google searches for "GRAPHICAL_PLAN", continuing to fool readers long past the original publishing date... hence, the new title, and this comment.



(This article is reprinted here with permission. It was first published on April 1, 2014.)

Folks often know exactly which queries qualify as Queries From Hell, and they often have ongoing problems with execution plans that change over time to cause performance to oscillate by orders of magnitude.

The most recent version of SQL Anywhere introduced a new feature for monitoring execution plans in production, called "Log Expensive Queries", similar to the older GRAPHICAL_PLAN function. Here's what the syntax looks like:
SET TEMPORARY OPTION LOG_EXPENSIVE_QUERIES = { 'ON' | 'OFF' };

SELECT [ other-clauses ] ...
[ LOG_EXPENSIVE_QUERY ( xml-plan, threshold-milliseconds ) ]

When a query containing a LOG_EXPENSIVE_QUERY clause is encountered during execution, the clause is ignored if the connection option LOG_EXPENSIVE_QUERIES is currently 'OFF'; there is no performance penalty in this case.

If LOG_EXPENSIVE_QUERIES is 'ON', however, the query engine preserves information about the execution plan until the query finishes executing. At that point, if the actual run time for the query was equal to or greater than the threshold-milliseconds argument in the LOG_EXPENSIVE_QUERY clause, the XML version of the plan is returned in the xml-plan argument. It is then up to the application to do something with value in xml-plan; e.g., save it in a table or write it to a file.

If LOG_EXPENSIVE_QUERIES is 'ON' but the actual run time does not reach threshold-milliseconds, the xml-plan argument is set to NULL.

To demonstrate, here is an excerpt from a large stored procedure showing a query that took almost 123 seconds to run:
CREATE PROCEDURE ...
...
SELECT TOP 1 rroad_sample_set.sample_set_number
INTO @month_older_sample_set_number
FROM rroad_sample_set
WHERE rroad_sample_set.sampling_id = @sampling_id
AND rroad_sample_set.sample_finished_at
<= DATEADD ( MONTH, -1, @sample_finished_at )
ORDER BY rroad_sample_set.sample_set_number DESC;
...
END;
Here's how the code was modified to use the new Log Expensive Queries feature:
CREATE TABLE saplan (
pkey       INTEGER NOT NULL DEFAULT AUTOINCREMENT PRIMARY KEY,
xml_plan   XML );

CREATE PROCEDURE ...
...
DECLARE @xml_plan XML;
...

SELECT TOP 1 rroad_sample_set.sample_set_number
INTO @month_older_sample_set_number
FROM rroad_sample_set
WHERE rroad_sample_set.sampling_id = @sampling_id
AND rroad_sample_set.sample_finished_at
<= DATEADD ( WEEK, -1, @sample_finished_at )
ORDER BY rroad_sample_set.sample_set_number DESC
LOG_EXPENSIVE_QUERY ( @xml_plan, 10000 );

IF @xml_plan IS NOT NULL THEN
INSERT saplan ( xml_plan ) VALUES ( @xml_plan );
SET TEMPORARY OPTION LOG_EXPENSIVE_QUERIES = 'OFF'; 
END IF;
...
END;
The table defined on lines 1 to 3 is used to store the plans captured at run time. The variable declared on line 7 is used as the first argument to the LOG_EXPENSIVE_QUERY clause. The LOG_EXPENSIVE_QUERY clause on line 17 names @xml_plan as the variable to receive the plan, and sets the threshold to 10,000 milliseconds. The code on lines 19 to 22 checks to see if the LOG_EXPENSIVE_QUERY clause did in fact capture a plan, and if so, it saves that plan in the saplan table and sets the LOG_EXPENSIVE_QUERIES option to 'OFF' so no more plans are captured. After the procedure ran in production and the code save the first plan, here's what the saplan table looks like: The dbisql utility has been enhanced to recognize XML values that contain graphical plans so that when you doubleclick on a plan it opens the Plan Viewer: Note that the Plan Viewer SQL pane shows the query after all rewrite optimizations have been performed, and after the actual values 8 and '2011 04 07 13:43:05.932' have been substituted for the host variables @sampling_id and @sample_finished_at.
(There is, of course, no such thing as the LOG_EXPENSIVE_QUERY clause... but there should be :)

Friday, April 8, 2011

The fRiDaY File

Recovering Across Multiple Backup Generations

Let's say you have 10 generations of database backups when you discover that the current database file is corrupt.

You restore from the most recent full backup and apply the subsequent incremental log backups (like in Demonstrating Full and Incremental Backups)...

only to discover...

Horrors!


...that the most recent backup of the database is corrupt too!

Bite The Bullet!


Now let's say you're not sure when the database first became corrupted, but you're pretty sure that the oldest backup is OK, and you don't have time to go back one generation at a time.

The following demonstration shows how you can go all the way back to the beginning and
  • restore the oldest backup (generation 1 of 10), then

  • apply all the subsequent log files to get rid of the corruption without losing any data.
These Help topics apply...

Command file 01_run_everything.bat automates the whole demonstration by calling the other command files in the right order:
  • Create the database and a table to record progress,

  • make 10 generations of backup files,

    • each consisting of a full backup

    • followed by three consecutive incremental log backups

    • with a new row inserted in the table after each full backup

    • and after the third incremental backup in each generation

    • for a total of 20 rows, then

  • show the rows as they exist before the restore begins,

  • delete the current database,

  • restore the full database backup file from generation 1,

  • apply all the subsequent incremental transaction log backup files

  • plus the current log file,

  • start the database and

  • show how all the rows have been restored.

CALL 02_run_dbinit12.bat
CALL 03_run_dbspawn_dbsrv12.bat
CALL 04_run_dbisql_to_create_table.bat

REM Generation 1...
CALL 05_run_dbbackup12_full.bat
CALL 06_run_dbisql_to_insert_row.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 06_run_dbisql_to_insert_row.bat

REM Generation 2...
CALL 05_run_dbbackup12_full.bat
CALL 06_run_dbisql_to_insert_row.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 06_run_dbisql_to_insert_row.bat

REM Generation 3...
CALL 05_run_dbbackup12_full.bat
CALL 06_run_dbisql_to_insert_row.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 06_run_dbisql_to_insert_row.bat

REM Generation 4...
CALL 05_run_dbbackup12_full.bat
CALL 06_run_dbisql_to_insert_row.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 06_run_dbisql_to_insert_row.bat

REM Generation 5...
CALL 05_run_dbbackup12_full.bat
CALL 06_run_dbisql_to_insert_row.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 06_run_dbisql_to_insert_row.bat

REM Generation 6...
CALL 05_run_dbbackup12_full.bat
CALL 06_run_dbisql_to_insert_row.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 06_run_dbisql_to_insert_row.bat

REM Generation 7...
CALL 05_run_dbbackup12_full.bat
CALL 06_run_dbisql_to_insert_row.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 06_run_dbisql_to_insert_row.bat

REM Generation 8...
CALL 05_run_dbbackup12_full.bat
CALL 06_run_dbisql_to_insert_row.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 06_run_dbisql_to_insert_row.bat

REM Generation 9...
CALL 05_run_dbbackup12_full.bat
CALL 06_run_dbisql_to_insert_row.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 06_run_dbisql_to_insert_row.bat

REM Generation 10...
CALL 05_run_dbbackup12_full.bat
CALL 06_run_dbisql_to_insert_row.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 06_run_dbisql_to_insert_row.bat

CALL 08_run_script_to_display_rows.bat
PAUSE Make a note how many rows exist in t1...

CALL 09_stop_drop_database.bat
CALL 10_restore_database.bat
CALL 03_run_dbspawn_dbsrv12.bat

CALL 08_run_script_to_display_rows.bat
PAUSE Note that the last row is missing from t1...
PAUSE All done...

Backup


02_run_dbinit12.bat starts the demonstration by creating an empty SQL Anywhere 12 database:

"%SQLANY12%\bin32\dbinit.exe"^
ddd12.db

03_run_dbspawn_dbsrv12.bat starts that database:

"%SQLANY12%\bin32\dbspawn.exe"^
-f "%SQLANY12%\bin32\dbsrv12.exe"^
-o dbsrv12_log_ddd12.txt^
-oe dbsrv12_log_fatal_ddd12.txt^
-os 10M^
-x tcpip^
-zl^
-zp^
-zt^
ddd12.db

04_run_dbisql_to_create_table.bat creates a table:

"%SQLANY12%\bin32\dbisql.com"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
CREATE TABLE t1 ( pkey INTEGER NOT NULL DEFAULT AUTOINCREMENT PRIMARY KEY );

05_run_dbbackup12_full.bat creates a full backup of the database and transaction log:

REM ******************************************************************
REM Create empty backup\generation_temp subfolder
MD backup
CD backup
RD /S /Q generation_temp
MD generation_temp
CD ..

ECHO ********************************************^
*********************************************>>backup\generation_temp\dbbackup_log.txt
ECHO Full dbbackup started >>backup\generation_temp\dbbackup_log.txt
DATE /T >>backup\generation_temp\dbbackup_log.txt
TIME /T >>backup\generation_temp\dbbackup_log.txt

"%SQLANY12%\bin32\dbbackup.exe"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
-o backup\generation_temp\dbbackup_log.txt^
-x^
backup\generation_temp

IF ERRORLEVEL 1 GOTO backup_failed

REM ******************************************************************
REM Move backup to generation10 subfolder
CD backup
RD /S /Q generation1
RENAME generation2 generation1
RENAME generation3 generation2
RENAME generation4 generation3
RENAME generation5 generation4
RENAME generation6 generation5
RENAME generation7 generation6
RENAME generation8 generation7
RENAME generation9 generation8
RENAME generation10 generation9
RENAME generation_temp generation10
CD ..
DIR /S backup\generation10\*.* >>backup\generation10\dbbackup_log.txt
ECHO Full dbbackup OK >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt
GOTO end

:backup_failed
REM ******************************************************************
REM Backup failed
ECHO Error: Full dbbackup failed >>backup\generation_temp\dbbackup_log.txt
DATE /T >>backup\generation_temp\dbbackup_log.txt
TIME /T >>backup\generation_temp\dbbackup_log.txt
GOTO end

:end

06_run_script.bat inserts a row into the table; this command is executed 20 times, after each full backup and each set of 3 incremental backups:

"%SQLANY12%\bin32\dbisql.com"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
INSERT t1 VALUES ( DEFAULT );

07_run_dbbackup12_incremental.bat is called to create each incremental log backup:

ECHO ********************************************^
*********************************************>>backup\generation10\dbbackup_log.txt
ECHO Incremental dbbackup started >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt

REM ******************************************************************
REM Make sure a full backup exists
IF EXIST "backup\generation10\ddd12.db" ( GOTO check_full_log_backup ) ELSE ( GOTO full_backup_is_missing )

:check_full_log_backup
IF EXIST "backup\generation10\ddd12.log" ( GOTO full_backup_exists ) ELSE ( GOTO full_backup_is_missing )

:full_backup_is_missing
ECHO Create a full backup before an incremental backup. >>backup\generation10\dbbackup_log.txt
GOTO backup_failed

:full_backup_exists
REM ******************************************************************
REM Backup to generation10\logs subfolder
CD backup\generation10
MD logs
CD ..\..

"%SQLANY12%\bin32\dbbackup.exe"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
-o backup\generation10\dbbackup_log.txt^
-n^
-t^
-x^
backup\generation10\logs

IF ERRORLEVEL 1 GOTO backup_failed

REM ******************************************************************
REM Backup OK
DIR /S backup\generation10\*.* >>backup\generation10\dbbackup_log.txt
ECHO Incremental dbbackup OK >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt
GOTO end

:backup_failed
REM ******************************************************************
REM Backup failed
ECHO Error: Incremental dbbackup failed >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt
GOTO end

:end

08_run_script_to_display_rows.bat shows all the rows in the table:

"%SQLANY12%\bin32\dbisql.com"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
SELECT * FROM t1 ORDER BY pkey;

Here's what the table looks like after all the backups have been completed, before the restore process begins:

pkey
-----------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

(20 rows)

Execution time: 0.051 seconds

Restore


09_stop_drop_database.bat makes way for the restore process by stopping and deleting the current database files:

"%SQLANY12%\bin32\dbstop.exe" -c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql" -y

PAUSE Wait until the database is stopped, then

ERASE /F ddd12.db

REM Note: The transaction log is not deleted.

In the real world most administrators won't delete the current database or log file no matter how dire the situation; they'll just move them to some other location. In particular, the current transaction log may be of some use, and that is certainly the case here.

10_restore_database.bat uses the COPY command to restore the ancient "generation 1" database backup, and then it runs dbsrv12.exe twenty-one times to apply all 40 of the transaction log backup files plus the current log:

ECHO ********************************************^
*********************************************>>backup\generation10\dbbackup_log.txt
ECHO Restore started >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt

COPY backup\generation1\ddd12.db

REM Note: -o writes to the dbbackup diagnostic file in this example.

REM The first dbsrv12 -ad backup\generation1 step is optional.
REM All the other dbsrv12 -ad steps are required.

"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation1
"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation1\logs

"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation2
"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation2\logs

"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation3
"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation3\logs

"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation4
"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation4\logs

"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation5
"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation5\logs

"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation6
"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation6\logs

"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation7
"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation7\logs

"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation8
"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation8\logs

"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation9
"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation9\logs

"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation10
"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -ad backup\generation10\logs

REM Use dbsrv12 -a to apply the most recent log.

"%SQLANY12%\bin32\dbsrv12.exe" -o backup\generation10\dbbackup_log.txt ddd12.db -a ddd12.log

REM ******************************************************************
REM Restore finished
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt

Here are some snippets from the diagnostic log messages produced by the 21 dbsrv12 -ad and dbsrv12 -a runs:

*****************************************************************************************
Restore started
Wed 04/06/2011
06:54 AM
I. 04/06 06:54:56. SQL Anywhere Network Server Version 12.0.1.3298 I. 04/06 06:54:56. Developer edition, not licensed for deployment.
...
I. 04/06 06:54:57. Database recovery in progress
I. 04/06 06:54:57. Last checkpoint at Wed Apr 06 2011 06:51
I. 04/06 06:54:57. Checkpoint log...
I. 04/06 06:54:57. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation1\ddd12.log...
I. 04/06 06:54:57. Checkpointing...
I. 04/06 06:54:57. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:54
I. 04/06 06:54:57. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:54
I. 04/06 06:54:58. Recovery complete
...
I. 04/06 06:54:58. Database recovery in progress
I. 04/06 06:54:58. Last checkpoint at Wed Apr 06 2011 06:54
I. 04/06 06:54:58. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation1\logs\110406AA.log...
I. 04/06 06:54:58. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:54
I. 04/06 06:54:59. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:54
I. 04/06 06:54:59. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:54
I. 04/06 06:54:59. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:54
I. 04/06 06:54:59. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation1\logs\110406AB.log...
I. 04/06 06:55:00. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:00. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:00. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:01. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:01. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation1\logs\110406AC.log...
I. 04/06 06:55:01. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:01. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:01. Checkpointing...
I. 04/06 06:55:01. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:01. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:01. Recovery complete
...
I. 04/06 06:55:02. Database recovery in progress
I. 04/06 06:55:02. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:02. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation2\ddd12.log...
I. 04/06 06:55:02. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:03. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:03. Checkpointing...
I. 04/06 06:55:03. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:03. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:03. Recovery complete
...
I. 04/06 06:55:04. Database recovery in progress
I. 04/06 06:55:04. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:04. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation2\logs\110406AA.log...
I. 04/06 06:55:04. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:04. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:04. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:05. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:05. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation2\logs\110406AB.log...
I. 04/06 06:55:05. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:06. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:06. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:06. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:06. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation2\logs\110406AC.log...
I. 04/06 06:55:06. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:06. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:07. Checkpointing...
I. 04/06 06:55:07. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:07. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:07. Recovery complete
...
I. 04/06 06:55:08. Database recovery in progress
I. 04/06 06:55:08. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:08. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation3\ddd12.log...
I. 04/06 06:55:09. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:09. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:09. Checkpointing...
I. 04/06 06:55:09. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:10. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:10. Recovery complete
...
I. 04/06 06:55:11. Database recovery in progress
I. 04/06 06:55:11. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:11. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation3\logs\110406AA.log...
I. 04/06 06:55:11. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:11. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:11. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:12. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:12. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation3\logs\110406AB.log...
I. 04/06 06:55:12. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:12. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:12. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:13. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:13. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation3\logs\110406AC.log...
I. 04/06 06:55:13. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:13. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:13. Checkpointing...
I. 04/06 06:55:13. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:14. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:14. Recovery complete
...
I. 04/06 06:55:15. Database recovery in progress
I. 04/06 06:55:15. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:15. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation4\ddd12.log...
I. 04/06 06:55:15. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:15. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:15. Checkpointing...
I. 04/06 06:55:15. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:16. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:16. Recovery complete
...
I. 04/06 06:55:16. Database recovery in progress
I. 04/06 06:55:16. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:16. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation4\logs\110406AA.log...
I. 04/06 06:55:17. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:17. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:17. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:17. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:17. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation4\logs\110406AB.log...
I. 04/06 06:55:17. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:18. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:18. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:18. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:18. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation4\logs\110406AC.log...
I. 04/06 06:55:18. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:18. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:18. Checkpointing...
I. 04/06 06:55:19. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:19. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:19. Recovery complete
...
I. 04/06 06:55:20. Database recovery in progress
I. 04/06 06:55:20. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:20. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation5\ddd12.log...
I. 04/06 06:55:20. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:21. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:21. Checkpointing...
I. 04/06 06:55:21. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:21. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:21. Recovery complete
...
I. 04/06 06:55:22. Database recovery in progress
I. 04/06 06:55:22. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:22. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation5\logs\110406AA.log...
I. 04/06 06:55:22. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:22. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:22. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:23. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:23. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation5\logs\110406AB.log...
I. 04/06 06:55:23. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:23. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:23. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:23. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:24. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation5\logs\110406AC.log...
I. 04/06 06:55:24. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:24. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:24. Checkpointing...
I. 04/06 06:55:24. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:25. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:25. Recovery complete
...
I. 04/06 06:55:26. Database recovery in progress
I. 04/06 06:55:26. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:26. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation6\ddd12.log...
I. 04/06 06:55:26. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:26. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:26. Checkpointing...
I. 04/06 06:55:26. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:27. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:27. Recovery complete
...
I. 04/06 06:55:27. Database recovery in progress
I. 04/06 06:55:27. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:27. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation6\logs\110406AA.log...
I. 04/06 06:55:28. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:28. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:28. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:28. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:28. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation6\logs\110406AB.log...
I. 04/06 06:55:28. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:29. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:29. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:30. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:30. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation6\logs\110406AC.log...
I. 04/06 06:55:30. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:30. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:30. Checkpointing...
I. 04/06 06:55:30. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:31. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:31. Recovery complete
...
I. 04/06 06:55:32. Database recovery in progress
I. 04/06 06:55:32. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:32. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation7\ddd12.log...
I. 04/06 06:55:32. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:32. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:32. Checkpointing...
I. 04/06 06:55:32. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:32. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:32. Recovery complete
...
I. 04/06 06:55:33. Database recovery in progress
I. 04/06 06:55:33. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:33. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation7\logs\110406AA.log...
I. 04/06 06:55:33. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:34. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:34. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:34. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:34. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation7\logs\110406AB.log...
I. 04/06 06:55:34. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:35. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:35. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:35. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:35. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation7\logs\110406AC.log...
I. 04/06 06:55:35. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:36. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:36. Checkpointing...
I. 04/06 06:55:36. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:36. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:36. Recovery complete
...
I. 04/06 06:55:37. Database recovery in progress
I. 04/06 06:55:37. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:37. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation8\ddd12.log...
I. 04/06 06:55:37. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:37. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:37. Checkpointing...
I. 04/06 06:55:37. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:38. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:38. Recovery complete
...
I. 04/06 06:55:39. Database recovery in progress
I. 04/06 06:55:39. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:39. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation8\logs\110406AA.log...
I. 04/06 06:55:39. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:39. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:39. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:40. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:40. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation8\logs\110406AB.log...
I. 04/06 06:55:40. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:40. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:40. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:41. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:41. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation8\logs\110406AC.log...
I. 04/06 06:55:41. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:41. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:41. Checkpointing...
I. 04/06 06:55:41. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:42. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:42. Recovery complete
...
I. 04/06 06:55:42. Database recovery in progress
I. 04/06 06:55:42. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:42. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation9\ddd12.log...
I. 04/06 06:55:43. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:43. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:43. Checkpointing...
I. 04/06 06:55:43. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:43. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:43. Recovery complete
...
I. 04/06 06:55:44. Database recovery in progress
I. 04/06 06:55:44. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:44. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation9\logs\110406AA.log...
I. 04/06 06:55:44. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:45. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:45. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:45. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:45. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation9\logs\110406AB.log...
I. 04/06 06:55:45. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:46. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:46. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:46. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:46. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation9\logs\110406AC.log...
I. 04/06 06:55:46. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:47. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:47. Checkpointing...
I. 04/06 06:55:47. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:47. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:47. Recovery complete
...
I. 04/06 06:55:58. Database recovery in progress
I. 04/06 06:55:58. Last checkpoint at Wed Apr 06 2011 06:55
I. 04/06 06:55:58. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation10\ddd12.log...
I. 04/06 06:55:58. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:55:59. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:55
I. 04/06 06:56:00. Checkpointing...
I. 04/06 06:56:00. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:00. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:00. Recovery complete
...
I. 04/06 06:56:01. Database recovery in progress
I. 04/06 06:56:01. Last checkpoint at Wed Apr 06 2011 06:56
I. 04/06 06:56:01. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation10\logs\110406AA.log...
I. 04/06 06:56:01. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:01. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:01. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:02. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:02. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation10\logs\110406AB.log...
I. 04/06 06:56:02. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:02. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:02. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:03. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:03. Transaction log: C:\$ blogs and websites\blog SQLAnywhere\20110499 Recovering Across Multiple Backup Generations\backup\generation10\logs\110406AC.log...
I. 04/06 06:56:03. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:03. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:03. Checkpointing...
I. 04/06 06:56:03. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:04. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:04. Recovery complete
...
I. 04/06 06:56:05. Database recovery in progress
I. 04/06 06:56:05. Last checkpoint at Wed Apr 06 2011 06:56
I. 04/06 06:56:05. Transaction log: ddd12.log...
I. 04/06 06:56:05. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:05. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:05. Checkpointing...
I. 04/06 06:56:05. Starting checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:06. Finished checkpoint of "ddd12" (ddd12.db) at Wed Apr 06 2011 06:56
I. 04/06 06:56:06. Recovery complete
I. 04/06 06:56:06. Database server shutdown automatically after log applied
I. 04/06 06:56:06. Database server stopped at Wed Apr 06 2011 06:56
Wed 04/06/2011
06:56 AM

Here's the kind of message you will see if one of the log files is missing:

E. 04/05 15:30:34. Cannot open transaction log file -- Can't use log file "C:\ ... \backup\generation9\logs\110405AA.log" since it has been used more recently than the database file

Here's what the table looks like after the restore; all 20 rows have been restored, even the row that was inserted after the last backup (it was restored by the final dbsrv12 -a step in 10_restore_database.bat):

pkey
-----------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

(20 rows)

Execution time: 0.039 seconds

Tip: It's tempting to move all the incremental log backup files into a single folder so only one dbsrv12 -ad step is required. However, it is possible for two different incremental log backup files to have the same file name if they were created on the same day with a full backup in between. That's because the yymmddXX is naming convention is restarted at yymmddAA after each full backup. In this demonstration, because everything happens in rapid succession on a single day, all 10 sets are named yymmddAA, BB and CC.

Finally, here is the 99_stop_drop_everything.bat command file that deletes everything so that 01_run_everything.bat run over again:

PAUSE Are you sure you want to delete all the files?

"%SQLANY12%\bin32\dbstop.exe" -c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql" -y

PAUSE Wait until the database is stopped, then

ERASE /F ddd12.db
ERASE /F *.log
ERASE /F dbsrv12_log_ddd12.txt
ERASE /F dbsrv12_log_fatal_ddd12.txt
RMDIR /S /Q backup

PAUSE

Wednesday, April 6, 2011

Quiz: Which log backups are required to restore a database?

Lets say you have a subfolder structure containing the following database backup files:


...\backup\generation10
ddd12.db
ddd12.log
...\backup\generation10\logs
110405AA.log
110405AB.log
110405AC.log

The ddd12.db and ddd12.log backup files were created by a single full backup run of dbbackup:

"%SQLANY12%\bin32\dbbackup.exe"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
-x^
backup\generation10

The yymmddXX.log files were created by three subsequent runs of an incremental log backup process:

"%SQLANY12%\bin32\dbbackup.exe"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
-n^
-t^
-x^
backup\generation10\logs

Is ddd12.log necessary?


Question: When it comes time to restore ddd12.db backup file and apply the subsequent *.log backup files, is it necessary to apply ddd12.log before applying the yymmddXX.log files?

Or can ddd12.log be skipped and just the yymmddXX.log files applied?

The following simple experiment is inconclusive. According to Demonstrating Full and Incremental Backups the following restore process works OK even though it skips ddd12.log:

"%SQLANY12%\bin32\dbsrv12.exe"^
-o backup\generation10\dbbackup_log.txt^
-oe dbsrv12_log_fatal_ddd12.txt^
-os 10M^
ddd12.db^
-ad backup\generation10\logs

I. 04/05 06:37:02. SQL Anywhere Network Server Version 12.0.1.3298 I. 04/05 06:37:02. Developer edition, not licensed for deployment.
I. 04/05 06:37:02. I. 04/05 06:37:02. Copyright © 2001-2011, iAnywhere Solutions, Inc.
I. 04/05 06:37:02. Portions copyright © 1988-2011, Sybase, Inc. All rights reserved.
I. 04/05 06:37:02. Use of this software is governed by the Sybase License Agreement.
I. 04/05 06:37:02. Refer to http://www.sybase.com/softwarelicenses.
I. 04/05 06:37:02. I. 04/05 06:37:02. Connection limit (licensed seats): 3
I. 04/05 06:37:02. Processors detected: 1 (containing 8 logical processors)
I. 04/05 06:37:02. Maximum number of physical processors the server will use: 1
I. 04/05 06:37:02. This server is licensed to:
I. 04/05 06:37:02. Developer Edition
I. 04/05 06:37:02. Restricted Use
I. 04/05 06:37:02. Running Windows 7 Build 7600 on X86_64
I. 04/05 06:37:02. Server built for X86 processor architecture
I. 04/05 06:37:02. 3216K of memory used for caching
I. 04/05 06:37:02. Minimum cache size: 2956K, maximum cache size: 3474688K
I. 04/05 06:37:02. Using a maximum page size of 4096 bytes
I. 04/05 06:37:02. Multiprogramming level: minimum:8, current:20, maximum:80
I. 04/05 06:37:02. Automatic tuning of multiprogramming level is enabled
I. 04/05 06:37:02. Starting database "ddd12" (C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\ddd12.db) at Tue Apr 05 2011 06:37
I. 04/05 06:37:02. Database recovery in progress
I. 04/05 06:37:02. Last checkpoint at Tue Apr 05 2011 06:36
I. 04/05 06:37:02. Checkpoint log...
I. 04/05 06:37:02. Transaction log: C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\backup\generation10\logs\110405AA.log...
I. 04/05 06:37:02. Starting checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:37
I. 04/05 06:37:03. Finished checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:37
I. 04/05 06:37:03. Starting checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:37
I. 04/05 06:37:03. Finished checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:37
I. 04/05 06:37:03. Transaction log: C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\backup\generation10\logs\110405AB.log...
I. 04/05 06:37:03. Starting checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:37
I. 04/05 06:37:04. Finished checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:37
I. 04/05 06:37:04. Starting checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:37
I. 04/05 06:37:04. Finished checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:37
I. 04/05 06:37:04. Transaction log: C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\backup\generation10\logs\110405AC.log...
I. 04/05 06:37:04. Starting checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:37
I. 04/05 06:37:05. Finished checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:37
I. 04/05 06:37:05. Checkpointing...
I. 04/05 06:37:05. Starting checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:37
I. 04/05 06:37:05. Finished checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:37
I. 04/05 06:37:05. Recovery complete
I. 04/05 06:37:05. Database server shutdown automatically after log applied
I. 04/05 06:37:05. Database server stopped at Tue Apr 05 2011 06:37

However, the same restore process also works OK when it is modified to apply ddd12.log before the yymmddXX.log files:

"%SQLANY12%\bin32\dbsrv12.exe"^
-o backup\generation10\dbbackup_log.txt^
-oe dbsrv12_log_fatal_ddd12.txt^
-os 10M^
ddd12.db^
-ad backup\generation10

"%SQLANY12%\bin32\dbsrv12.exe"^
-o backup\generation10\dbbackup_log.txt^
-oe dbsrv12_log_fatal_ddd12.txt^
-os 10M^
ddd12.db^
-ad backup\generation10\logs

I. 04/05 06:31:30. SQL Anywhere Network Server Version 12.0.1.3298 I. 04/05 06:31:30. Developer edition, not licensed for deployment.
I. 04/05 06:31:30. I. 04/05 06:31:30. Copyright © 2001-2011, iAnywhere Solutions, Inc.
I. 04/05 06:31:30. Portions copyright © 1988-2011, Sybase, Inc. All rights reserved.
I. 04/05 06:31:30. Use of this software is governed by the Sybase License Agreement.
I. 04/05 06:31:30. Refer to http://www.sybase.com/softwarelicenses.
I. 04/05 06:31:30. I. 04/05 06:31:30. Connection limit (licensed seats): 3
I. 04/05 06:31:30. Processors detected: 1 (containing 8 logical processors)
I. 04/05 06:31:30. Maximum number of physical processors the server will use: 1
I. 04/05 06:31:30. This server is licensed to:
I. 04/05 06:31:30. Developer Edition
I. 04/05 06:31:30. Restricted Use
I. 04/05 06:31:30. Running Windows 7 Build 7600 on X86_64
I. 04/05 06:31:30. Server built for X86 processor architecture
I. 04/05 06:31:30. 3216K of memory used for caching
I. 04/05 06:31:30. Minimum cache size: 2956K, maximum cache size: 3474688K
I. 04/05 06:31:30. Using a maximum page size of 4096 bytes
I. 04/05 06:31:30. Multiprogramming level: minimum:8, current:20, maximum:80
I. 04/05 06:31:30. Automatic tuning of multiprogramming level is enabled
I. 04/05 06:31:30. Starting database "ddd12" (C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:30. Database recovery in progress
I. 04/05 06:31:30. Last checkpoint at Tue Apr 05 2011 06:31
I. 04/05 06:31:30. Checkpoint log...
I. 04/05 06:31:40. Transaction log: C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\backup\generation10\ddd12.log...
I. 04/05 06:31:40. Checkpointing...
I. 04/05 06:31:40. Starting checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:41. Finished checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:41. Recovery complete
I. 04/05 06:31:41. Database server shutdown automatically after log applied
I. 04/05 06:31:41. Database server stopped at Tue Apr 05 2011 06:31
I. 04/05 06:31:42. SQL Anywhere Network Server Version 12.0.1.3298 I. 04/05 06:31:42. Developer edition, not licensed for deployment.
I. 04/05 06:31:42. I. 04/05 06:31:42. Copyright © 2001-2011, iAnywhere Solutions, Inc.
I. 04/05 06:31:42. Portions copyright © 1988-2011, Sybase, Inc. All rights reserved.
I. 04/05 06:31:42. Use of this software is governed by the Sybase License Agreement.
I. 04/05 06:31:42. Refer to http://www.sybase.com/softwarelicenses.
I. 04/05 06:31:42. I. 04/05 06:31:42. Connection limit (licensed seats): 3
I. 04/05 06:31:42. Processors detected: 1 (containing 8 logical processors)
I. 04/05 06:31:42. Maximum number of physical processors the server will use: 1
I. 04/05 06:31:42. This server is licensed to:
I. 04/05 06:31:42. Developer Edition
I. 04/05 06:31:42. Restricted Use
I. 04/05 06:31:42. Running Windows 7 Build 7600 on X86_64
I. 04/05 06:31:42. Server built for X86 processor architecture
I. 04/05 06:31:42. 3216K of memory used for caching
I. 04/05 06:31:42. Minimum cache size: 2956K, maximum cache size: 3474688K
I. 04/05 06:31:42. Using a maximum page size of 4096 bytes
I. 04/05 06:31:42. Multiprogramming level: minimum:8, current:20, maximum:80
I. 04/05 06:31:42. Automatic tuning of multiprogramming level is enabled
I. 04/05 06:31:42. Starting database "ddd12" (C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:42. Database recovery in progress
I. 04/05 06:31:42. Last checkpoint at Tue Apr 05 2011 06:31
I. 04/05 06:31:42. Transaction log: C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\backup\generation10\logs\110405AA.log...
I. 04/05 06:31:42. Starting checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:42. Finished checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:42. Starting checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:43. Finished checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:43. Transaction log: C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\backup\generation10\logs\110405AB.log...
I. 04/05 06:31:43. Starting checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:43. Finished checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:44. Starting checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:44. Finished checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:44. Transaction log: C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\backup\generation10\logs\110405AC.log...
I. 04/05 06:31:44. Starting checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:44. Finished checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:44. Checkpointing...
I. 04/05 06:31:44. Starting checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:45. Finished checkpoint of "ddd12" (ddd12.db) at Tue Apr 05 2011 06:31
I. 04/05 06:31:45. Recovery complete
I. 04/05 06:31:45. Database server shutdown automatically after log applied
I. 04/05 06:31:45. Database server stopped at Tue Apr 05 2011 06:31

Huh?


So, what's the answer? Why do both restores work?

And which method should be used?

Monday, April 4, 2011

Sending Email From SQL Anywhere 12 Via Google's SMTP Server

SQL Anywhere lets you send email via MAPI and SMTP from inside your SQL code by calling system procedures like xp_sendmail(). However, many shops don't allow MAPI messages to be sent from within program code, and they don't run SMTP servers at all.

One solution is to use a Google Mail account to send emails via Google's SMTP server smtp.gmail.com.

(This article is based on Eric Farrar's original announcement of Gmail support in SQL Anywhere 12
and Mark Culp's update on the subject of using the Equifax certificate.)
In order to use smtp.gmail.com you need to call xp_startsmtp and provide three pieces of identification:
  1. a Google Mail account,

  2. the password for that account and

  3. the SSL certificate currently used by Google Mail.
Items 1 and 2 are easy to get; here's how to get number 3:
  • Choose a folder to store the SSL certificate; e.g., c:\temp

  • Ask around to see if anyone knows what SSL certificate Google is currently using for smtp.gmail.com, and where you can get it from.

  • Today's answers are "Equifax Secure Certificate Authority, and you can get if from GeoTrust".

  • [skipping ahead] Open this link in your browser: Download - Equifax Secure Certificate Authority (Base-64 encoded X.509)

  • Click right-mouse - Save As... anywhere on the page of carp stuff you see ( the page you get, not the image above :)

  • Choose a File name: c:\temp\Equifax_Secure_Certificate_Authority.cer

  • Choose a Save as type: Web Page, Complete

  • Click on Save, then

  • Edit the following script to specify the certificate file specification: SET @trusted_certificates = 'c:\\temp\\Equifax_Secure_Certificate_Authority.cer';

CREATE PROCEDURE send_email_via_gmail (
IN @recipient LONG VARCHAR,
IN @subject LONG VARCHAR,
IN @message LONG VARCHAR )
BEGIN

DECLARE @return_code INTEGER;
DECLARE @smtp_sender LONG VARCHAR;
DECLARE @smtp_server LONG VARCHAR;
DECLARE @smtp_port INTEGER;
DECLARE @timeout INTEGER;
DECLARE @smtp_sender_name LONG VARCHAR;
DECLARE @smtp_auth_username LONG VARCHAR;
DECLARE @smtp_auth_password LONG VARCHAR;
DECLARE @trusted_certificates LONG VARCHAR;

MESSAGE STRING ( '@recipient = "', @recipient, '"' ) TO CLIENT;
MESSAGE STRING ( '@subject = "', @subject, '"' ) TO CLIENT;
MESSAGE STRING ( '@message = "', @message, '"' ) TO CLIENT;

SET @smtp_sender = 'your.name@gmail.com';
SET @smtp_server = 'smtp.gmail.com';
SET @smtp_port = 587; -- 25 for standard SMTP, 587 for gmail
SET @timeout = 10; -- default is 60 seconds
SET @smtp_sender_name = 'Your Name';
SET @smtp_auth_username = 'your.name@gmail.com';
SET @smtp_auth_password = 'your.password';
SET @trusted_certificates = 'c:\\temp\\Equifax_Secure_Certificate_Authority.cer';

@return_code = CALL xp_startsmtp (
smtp_sender = @smtp_sender,
smtp_server = @smtp_server,
smtp_port = @smtp_port,
timeout = @timeout,
smtp_sender_name = @smtp_sender_name,
smtp_auth_username = @smtp_auth_username,
smtp_auth_password = @smtp_auth_password,
trusted_certificates = @trusted_certificates );

MESSAGE STRING ( 'xp_startsmtp @return_code = ', @return_code ) TO CLIENT;

@return_code = CALL xp_sendmail (
recipient = @recipient,
subject = @subject,
"message" = @message );

MESSAGE STRING ( 'xp_sendmail @return_code = ', @return_code ) TO CLIENT;

CALL xp_stopsmtp(); -- do not bother to check return code

EXCEPTION WHEN OTHERS THEN
CALL xp_stopsmtp();

END;

You will also have to change a bunch of other "your.name" stuff; I'll leave that up to you.

Here's how to call that procedure from inside your SQL code:

CALL send_email_via_gmail (
'breck.carter@gmail.com',
'Testing...',
'Hello, World!' );

You can also call it via dbisql to send an email from a Windows command file:

"%SQLANY12%\bin32\dbisql.com"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
CALL send_email_via_gmail (^
'breck.carter@gmail.com',^
'Testing...',^
'Hello, World!' )

The backup command files from Demonstrating Full and Incremental Backups can be modified as follows to send OK / FAILED email messages; see the dbisql commands at lines 43 and 59 in 05_run_dbbackup12_full.bat:

REM ******************************************************************
REM Create empty backup\generation_temp subfolder
MD backup
CD backup
RD /S /Q generation_temp
MD generation_temp
CD ..

ECHO ********************************************^
*********************************************>>backup\generation_temp\dbbackup_log.txt
ECHO Full dbbackup started >>backup\generation_temp\dbbackup_log.txt
DATE /T >>backup\generation_temp\dbbackup_log.txt
TIME /T >>backup\generation_temp\dbbackup_log.txt

"%SQLANY12%\bin32\dbbackup.exe"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
-o backup\generation_temp\dbbackup_log.txt^
-x^
backup\generation_temp

IF ERRORLEVEL 1 GOTO backup_failed

REM ******************************************************************
REM Move backup to generation10 subfolder
CD backup
RD /S /Q generation1
RENAME generation2 generation1
RENAME generation3 generation2
RENAME generation4 generation3
RENAME generation5 generation4
RENAME generation6 generation5
RENAME generation7 generation6
RENAME generation8 generation7
RENAME generation9 generation8
RENAME generation10 generation9
RENAME generation_temp generation10
CD ..
DIR /S backup\generation10\*.* >>backup\generation10\dbbackup_log.txt
ECHO Full dbbackup OK >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt

"%SQLANY12%\bin32\dbisql.com"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
CALL send_email_via_gmail (^
'breck.carter@gmail.com',^
'Full dbbackup OK - ddd12',^
'See folder %CD%\backup\generation10' )

GOTO end

:backup_failed
REM ******************************************************************
REM Backup failed
ECHO Error: Full dbbackup failed >>backup\generation_temp\dbbackup_log.txt
DATE /T >>backup\generation_temp\dbbackup_log.txt
TIME /T >>backup\generation_temp\dbbackup_log.txt

"%SQLANY12%\bin32\dbisql.com"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
CALL send_email_via_gmail (^
'breck.carter@gmail.com',^
'Full dbbackup FAILED - ddd12',^
'See diagnostics in %CD%\backup\generation_temp\dbbackup_log.txt' )

GOTO end

:end

Also see the dbisql commands at lines 42 and 58 in 07_run_dbbackup12_incremental.bat:

ECHO ********************************************^
*********************************************>>backup\generation10\dbbackup_log.txt
ECHO Incremental dbbackup started >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt

REM ******************************************************************
REM Make sure a full backup exists
IF EXIST "backup\generation10\ddd12.db" ( GOTO check_full_log_backup ) ELSE ( GOTO full_backup_is_missing )

:check_full_log_backup
IF EXIST "backup\generation10\ddd12.log" ( GOTO full_backup_exists ) ELSE ( GOTO full_backup_is_missing )

:full_backup_is_missing
ECHO Create a full backup before an incremental backup. >>backup\generation10\dbbackup_log.txt
GOTO backup_failed

:full_backup_exists
REM ******************************************************************
REM Backup to generation10\logs subfolder
CD backup\generation10
MD logs
CD ..\..

"%SQLANY12%\bin32\dbbackup.exe"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
-o backup\generation10\dbbackup_log.txt^
-n^
-t^
-x^
backup\generation10\logs

IF ERRORLEVEL 1 GOTO backup_failed

REM ******************************************************************
REM Backup OK
DIR /S backup\generation10\*.* >>backup\generation10\dbbackup_log.txt
ECHO Incremental dbbackup OK >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt

"%SQLANY12%\bin32\dbisql.com"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
CALL send_email_via_gmail (^
'breck.carter@gmail.com',^
'Incremental dbbackup OK - ddd12',^
'See folder %CD%\backup\generation10\logs' )

GOTO end

:backup_failed
REM ******************************************************************
REM Backup failed
ECHO Error: Incremental dbbackup failed >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt

"%SQLANY12%\bin32\dbisql.com"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
CALL send_email_via_gmail (^
'breck.carter@gmail.com',^
'Incremental dbbackup FAILED - ddd12',^
'See diagnostics in %CD%\backup\generation10\dbbackup_log.txt' )

GOTO end

:end

Here's what the "OK" emails look like:



Friday, April 1, 2011

Gmail Motion

Demonstrating Full and Incremental Backups

This article demonstrates two Windows command files which can be used to automate both full and incremental log backups of a SQL Anywhere 12 database:

  • The first command file creates a full backup of the database and transaction log files and preserves the last 10 full backups.

  • The second command file creates an incremental backup of the transaction log file and stores an unlimited number of those backups together with the most recent full backup.
Those command files are numbers 5 and 7 in a series of 15 command files used to present the demonstration; here's where you can download the full set...


Here's the $read_me.txt file:
2011 04 01  Demonstrate Restoring from an Incremental Backup

Run these commands in order to create, backup, modify and restore a SQL Anywhere 12 database:

01_run_everything.bat                    CALLs all the command files 02 through 15
02_run_dbinit12.bat                      create database
03_run_dbspawn_dbsrv12.bat               start database
04_run_script.bat                        run 04s_script_to_initialize_data.sql
05_run_dbbackup12_full.bat               full backup
06_run_script.bat                        run 06s_script_to_change_data.sql
07_run_dbbackup12_incremental.bat        incremental backup
08_run_script.bat                        run 08s_script_to_change_data.sql
09_run_dbbackup12_incremental.bat         [ repeat 07 ]
10_run_script.bat                        run 10s_script_to_change_data.sql
11_run_dbbackup12_incremental.bat         [ repeat 07 ]
12_stop_drop_database.bat                delete database
13_restore_database.bat                  apply incremental log backups
14_run_dbspawn_dbsrv12.bat                [ repeat 03 ]
15_run_script.bat                        run 15s_script_to_display_data.sql

To delete everything so the demonstration can be repeated:

16_stop_drop_everything.bat

Command file 01_run_everything.bat automates the whole demonstration by calling every other command file from 02 through 15:
CALL 02_run_dbinit12.bat
CALL 03_run_dbspawn_dbsrv12.bat
CALL 04_run_script.bat
CALL 05_run_dbbackup12_full.bat
CALL 06_run_script.bat
CALL 07_run_dbbackup12_incremental.bat
CALL 08_run_script.bat
CALL 09_run_dbbackup12_incremental.bat
CALL 10_run_script.bat
CALL 11_run_dbbackup12_incremental.bat
CALL 12_stop_drop_database.bat
CALL 13_restore_database.bat
CALL 14_run_dbspawn_dbsrv12.bat
CALL 15_run_script.bat
PAUSE All done...

Command file 02_run_dbinit12.bat starts the demonstration by creating an empty SQL Anywhere 13 database:
"%SQLANY12%\bin32\dbinit.exe"^
ddd12.db

Command file 03_run_dbspawn_dbsrv12.bat starts that database:
"%SQLANY12%\bin32\dbspawn.exe"^
-f "%SQLANY12%\bin32\dbsrv12.exe"^
-o dbsrv12_log_ddd12.txt^
-oe dbsrv12_log_fatal_ddd12.txt^
-os 10M^
-x tcpip^
-zl^
-zp^
-zt^
ddd12.db 

Command file 04_run_script.bat create a table and inserts one row:
"%SQLANY12%\bin32\dbisql.com"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
READ ENCODING Cp1252 04s_script_to_initialize_data.sql

Here is the script file 04s_script_to_initialize_data.sql:
CREATE TABLE t1 (
pkey   INTEGER NOT NULL PRIMARY KEY,
data   INTEGER NOT NULL DEFAULT 0 );

INSERT t1 VALUES ( 1, 1 );

COMMIT;

Rotating Full Backup


Command file 05_run_dbbackup12_full.bat creates the full backup; you can set up a Windows Task Scheduler entry to run it on a regular basis (e.g., every day at 1 AM):
REM ******************************************************************
REM Create empty backup\generation_temp subfolder
MD backup
CD backup
RD /S /Q generation_temp
MD generation_temp
CD ..

ECHO ********************************************^
*********************************************>>backup\generation_temp\dbbackup_log.txt
ECHO Full dbbackup started >>backup\generation_temp\dbbackup_log.txt
DATE /T >>backup\generation_temp\dbbackup_log.txt
TIME /T >>backup\generation_temp\dbbackup_log.txt

"%SQLANY12%\bin32\dbbackup.exe"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
-o backup\generation_temp\dbbackup_log.txt^
-x^
backup\generation_temp

IF ERRORLEVEL 1 GOTO backup_failed

REM ******************************************************************
REM Move backup to generation10 subfolder
CD backup
RD /S /Q generation1
RENAME generation2 generation1
RENAME generation3 generation2
RENAME generation4 generation3
RENAME generation5 generation4
RENAME generation6 generation5
RENAME generation7 generation6
RENAME generation8 generation7
RENAME generation9 generation8
RENAME generation10 generation9
RENAME generation_temp generation10
CD ..
DIR /S backup\generation10\*.* >>backup\generation10\dbbackup_log.txt
ECHO Full dbbackup OK >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt
GOTO end

:backup_failed
REM ******************************************************************
REM Backup failed
ECHO Error: Full dbbackup failed >>backup\generation_temp\dbbackup_log.txt
DATE /T >>backup\generation_temp\dbbackup_log.txt
TIME /T >>backup\generation_temp\dbbackup_log.txt
GOTO end

:end
Line 3 of the full backup command file 05_run_dbbackup12_full.bat makes sure that the backup subfolder exists. Lines 4 and 5 deletes the subfolder backup\generation_temp if it exists, and line 6 creates it again; this is where the new backup files will reside until the backup process has finished successfully.

The ECHO command on lines 9 and 10 writes a separator line to diagnostic log file dbbackup_log.txt. A new copy of dbbackup_log.txt is started for each full backup, and more records are added by this command file and by the later incremental log backups.

Lines 15 through 19 run dbbackup.exe to create a backup copy of the database and log files in the backup\generation_temp folder. The -x option tells dbbackup to delete and restart the primary transaction log file after the backup log file has been written. The -y option is not used because this command file doesn't overwrite any files.

The IF command on line 21 skips to the end of the command file if dbbackup.exe failed.

The commands on lines 23 through 37 preserve up to 10 most recent full backups:
  • The oldest subfolder (generation1) is deleted if it exists,

  • the 9 newer subfolders generation2 to 10 are given earlier names generation 1 through 9, if they exist, and

  • the newest subfolder generation_temp is renamed generation10.
The commands on lines 38 through 42 record a successful backup in the diagnostic log file, and the commands on lines 44 through 50 record a failure.

Here's a snippet from dbbackup_log.txt showing the full backup:
*****************************************************************************************
Full dbbackup started 
Fri 04/01/2011 
09:32 AM
SQL Anywhere Backup Utility Version 12.0.1.3298
(582 of estimated 582 pages, 100% complete)
Transaction log truncated
Database backup completed
Volume in drive C is OS
Volume Serial Number is 5CD7-70E9

Directory of C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\backup\generation10

04/01/2011  09:32 AM    <DIR>          .
04/01/2011  09:32 AM    <DIR>          ..
04/01/2011  09:32 AM               291 dbbackup_log.txt
04/01/2011  09:32 AM         2,367,488 ddd12.db
04/01/2011  09:32 AM             8,192 ddd12.log
3 File(s)      2,375,971 bytes

Total Files Listed:
3 File(s)      2,375,971 bytes
2 Dir(s)  114,212,237,312 bytes free
Full dbbackup OK 
Fri 04/01/2011 
09:32 AM

Command file 06_run_script.bat inserts another row:
"%SQLANY12%\bin32\dbisql.com"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
READ ENCODING Cp1252 06s_script_to_change_data.sql

Here is the script file 06s_script_to_change_data.sql:
INSERT t1 VALUES ( 2, 2 );

COMMIT;

Incremental Log Backup


Command file 07_run_dbbackup12_incremental.bat creates an incremental log backup; you can set up a Windows Task Scheduler entry to run it on a regular basis (e.g., every hour from 6 AM to 6 PM):
ECHO ********************************************^
*********************************************>>backup\generation10\dbbackup_log.txt
ECHO Incremental dbbackup started >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt

REM ******************************************************************
REM Make sure a full backup exists
IF EXIST "backup\generation10\ddd12.db" ( GOTO check_full_log_backup ) ELSE ( GOTO full_backup_is_missing )

:check_full_log_backup
IF EXIST "backup\generation10\ddd12.log" ( GOTO full_backup_exists ) ELSE ( GOTO full_backup_is_missing )

:full_backup_is_missing
ECHO Create a full backup before an incremental backup. >>backup\generation10\dbbackup_log.txt
GOTO backup_failed

:full_backup_exists
REM ******************************************************************
REM Backup to generation10\logs subfolder
CD backup\generation10
MD logs
CD ..\..

"%SQLANY12%\bin32\dbbackup.exe"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
-o backup\generation10\dbbackup_log.txt^
-n^
-t^
-x^
backup\generation10\logs

IF ERRORLEVEL 1 GOTO backup_failed

REM ******************************************************************
REM Backup OK
DIR /S backup\generation10\*.* >>backup\generation10\dbbackup_log.txt
ECHO Incremental dbbackup OK >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt
GOTO end

:backup_failed
REM ******************************************************************
REM Backup failed
ECHO Error: Incremental dbbackup failed >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt
GOTO end

:end
Lines 1 through 5 of the incremental log backup command file 07_run_dbbackup12_incremental.bat assume that a full backup already exists in the backup\generation10 subfolder, so it's OK to continue writing information to the diagnostic log file dbbackup_log.txt.

Lines 7 through 16 put that assumption to the test by ensuring the backup file copies of the database and transaction log exist in the backup\generation10 subfolder; if they don't exist, there's really no point creating a further incremental log backup.

Lines 18 through 23 make sure that the backup\generation10\logs subfolder exists. It might exist already, and that's ok; unlike the full backup command file, this command file always writes the new incremental log backup file to the same subfolder rather than creating a new subfolder.

Lines 25 through 31 run dbbackup.exe to create an incremental backup copy of the transaction log file in the backup\generation_temp\logs folder. The
  • -n option tells dbbackup to rename the backup copy of the transaction log file from ddd12.log to yymmddxx.log, where yymmdd is the date and xx is AA, AB, AC, ...,

  • the -t option to backup the transaction log file, not the database file, and

  • the -x option tells dbbackup to delete and restart the primary transaction log file after the backup log file has been written.
The -y option is not used because this command file doesn't overwrite any files.

The IF command on line 33 skips to the end of the command file if dbbackup.exe failed.

The commands on lines 35 through 41 record a successful backup in the diagnostic log file, and the commands on lines 43 through 49 record a failure.

Here's a snippet from dbbackup_log.txt showing one incremental log backup:
*****************************************************************************************
Incremental dbbackup started 
Fri 04/01/2011 
09:32 AM
SQL Anywhere Backup Utility Version 12.0.1.3298
(2 of estimated 2 pages, 100% complete)
Transaction log truncated
Database backup completed
Volume in drive C is OS
Volume Serial Number is 5CD7-70E9

Directory of C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\backup\generation10

04/01/2011  09:32 AM    <DIR>          .
04/01/2011  09:32 AM    <DIR>          ..
04/01/2011  09:32 AM             1,221 dbbackup_log.txt
04/01/2011  09:32 AM         2,367,488 ddd12.db
04/01/2011  09:32 AM             8,192 ddd12.log
04/01/2011  09:32 AM    <DIR>          logs
3 File(s)      2,376,901 bytes

Directory of C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\backup\generation10\logs

04/01/2011  09:32 AM    <DIR>          .
04/01/2011  09:32 AM    <DIR>          ..
04/01/2011  09:32 AM             8,192 110401AA.log
1 File(s)          8,192 bytes

Total Files Listed:
4 File(s)      2,385,093 bytes
5 Dir(s)  114,212,229,120 bytes free
Incremental dbbackup OK 
Fri 04/01/2011 
09:32 AM

Command file 08_run_script.bat inserts a third row and creates a second table:
"%SQLANY12%\bin32\dbisql.com"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
READ ENCODING Cp1252 08s_script_to_change_data.sql

Here is the script file 08s_script_to_change_data.sql:
INSERT t1 VALUES ( 3, 3 );

COMMIT;

CREATE TABLE t2 (
pkey   INTEGER NOT NULL PRIMARY KEY,
data   INTEGER NOT NULL DEFAULT 0 );

INSERT t2 VALUES ( 11, 11 );

COMMIT;

Command file 09_run_dbbackup12_incremental.bat creates another incremental log backup:
CALL 07_run_dbbackup12_incremental.bat

Command file 10_run_script.bat inserts a second row in the new table:
"%SQLANY12%\bin32\dbisql.com"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
READ ENCODING Cp1252 10s_script_to_change_data.sql

Here is the script file 10s_script_to_change_data.sql:
INSERT t2 VALUES ( 22, 22 );

COMMIT;

Command file 11_run_dbbackup12_incremental.bat creates another incremental log backup:
CALL 07_run_dbbackup12_incremental.bat

Restore


Command file 12_stop_drop_database.bat simulates disaster by deleting the database:
PAUSE Are you sure you want to delete the database?

"%SQLANY12%\bin32\dbstop.exe" -c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql" -y

PAUSE Wait until the database is stopped, then

ERASE /F ddd12.db
ERASE /F ddd12.log

Command file 13_restore_database.bat restores the full backup and applies the incremental log backups:
ECHO ********************************************^
*********************************************>>backup\generation10\dbbackup_log.txt
ECHO Restore started >>backup\generation10\dbbackup_log.txt
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt

COPY backup\generation10\ddd12.db

REM Note: -o writes to the dbbackup diagnostic file in this example.

"%SQLANY12%\bin32\dbsrv12.exe"^
-o backup\generation10\dbbackup_log.txt^
-oe dbsrv12_log_fatal_ddd12.txt^
-os 10M^
ddd12.db^
-ad backup\generation10\logs

REM ******************************************************************
REM Restore finished
DATE /T >>backup\generation10\dbbackup_log.txt
TIME /T >>backup\generation10\dbbackup_log.txt

Here's a snippet from dbbackup_log.txt showing how the dbsrv12 -ad option worked to apply the incremental transaction logs:
*****************************************************************************************
Restore started 
Fri 04/01/2011 
09:32 AM
I. 04/01 09:32:48. SQL Anywhere Network Server Version 12.0.1.3298 I. 04/01 09:32:48. Developer edition, not licensed for deployment.
I. 04/01 09:32:48.  I. 04/01 09:32:48. Copyright © 2001-2011, iAnywhere Solutions, Inc.
I. 04/01 09:32:48. Portions copyright © 1988-2011, Sybase, Inc. All rights reserved.
I. 04/01 09:32:48. Use of this software is governed by the Sybase License Agreement.
I. 04/01 09:32:48. Refer to http://www.sybase.com/softwarelicenses.
I. 04/01 09:32:48.  I. 04/01 09:32:48. Connection limit (licensed seats): 3
I. 04/01 09:32:48. Processors detected: 1 (containing 8 logical processors)
I. 04/01 09:32:48. Maximum number of physical processors the server will use: 1
I. 04/01 09:32:48. This server is licensed to:
I. 04/01 09:32:48.     Developer Edition
I. 04/01 09:32:48.     Restricted Use
I. 04/01 09:32:48. Running Windows 7 Build 7600  on X86_64
I. 04/01 09:32:48. Server built for X86 processor architecture
I. 04/01 09:32:49. 3216K of memory used for caching
I. 04/01 09:32:49. Minimum cache size: 2956K, maximum cache size: 3473660K
I. 04/01 09:32:49. Using a maximum page size of 4096 bytes
I. 04/01 09:32:49. Multiprogramming level: minimum:8, current:20, maximum:80
I. 04/01 09:32:49. Automatic tuning of multiprogramming level is enabled
I. 04/01 09:32:49. Starting database "ddd12" (C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\ddd12.db) at Fri Apr 01 2011 09:32
I. 04/01 09:32:49. Database recovery in progress
I. 04/01 09:32:49.     Last checkpoint at Fri Apr 01 2011 09:32
I. 04/01 09:32:49.     Checkpoint log...
I. 04/01 09:32:49.     Transaction log: C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\backup\generation10\logs\110401AA.log...
I. 04/01 09:32:49. Starting checkpoint of "ddd12" (ddd12.db) at Fri Apr 01 2011 09:32
I. 04/01 09:32:49. Finished checkpoint of "ddd12" (ddd12.db) at Fri Apr 01 2011 09:32
I. 04/01 09:32:50. Starting checkpoint of "ddd12" (ddd12.db) at Fri Apr 01 2011 09:32
I. 04/01 09:32:50. Finished checkpoint of "ddd12" (ddd12.db) at Fri Apr 01 2011 09:32
I. 04/01 09:32:50.     Transaction log: C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\backup\generation10\logs\110401AB.log...
I. 04/01 09:32:50. Starting checkpoint of "ddd12" (ddd12.db) at Fri Apr 01 2011 09:32
I. 04/01 09:32:51. Finished checkpoint of "ddd12" (ddd12.db) at Fri Apr 01 2011 09:32
I. 04/01 09:32:51. Starting checkpoint of "ddd12" (ddd12.db) at Fri Apr 01 2011 09:32
I. 04/01 09:32:51. Finished checkpoint of "ddd12" (ddd12.db) at Fri Apr 01 2011 09:32
I. 04/01 09:32:51.     Transaction log: C:\projects\$SA_templates\run\dbbackup\demo_restore_incremental_backup12\backup\generation10\logs\110401AC.log...
I. 04/01 09:32:51. Starting checkpoint of "ddd12" (ddd12.db) at Fri Apr 01 2011 09:32
I. 04/01 09:32:52. Finished checkpoint of "ddd12" (ddd12.db) at Fri Apr 01 2011 09:32
I. 04/01 09:32:52.     Checkpointing...
I. 04/01 09:32:52. Starting checkpoint of "ddd12" (ddd12.db) at Fri Apr 01 2011 09:32
I. 04/01 09:32:52. Finished checkpoint of "ddd12" (ddd12.db) at Fri Apr 01 2011 09:32
I. 04/01 09:32:52. Recovery complete
I. 04/01 09:32:52. Database server shutdown automatically after log applied
I. 04/01 09:32:52. Database server stopped at Fri Apr 01 2011 09:32
Fri 04/01/2011 
09:32 AM

Command file 14_run_dbspawn_dbsrv12.bat starts the freshly-restored database:
CALL 03_run_dbspawn_dbsrv12.bat

Command file 15_run_script.bat displays all the data in the database:
"%SQLANY12%\bin32\dbisql.com"^
-c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql"^
READ ENCODING Cp1252 15s_script_to_display_data.sql

Here is the script file 15s_script_to_display_data.sql:
SELECT 't1', * FROM t1
UNION ALL
SELECT 't2', * FROM t2 
ORDER BY 1, 2;

The output shows that both tables and all 5 rows have been successfully restored:
't1' pkey        data
----------------------------
t1   1           1
t1   2           2
t1   3           3
t2   11          11
t2   22          22

(5 rows)

Execution time: 0.02 seconds

Command file 16_stop_drop_everything.bat can be used to clean up so the demonstration can be started over again from scratch:
PAUSE Are you sure you want to delete all the files?

"%SQLANY12%\bin32\dbstop.exe" -c "ENG=ddd12;DBN=ddd12;UID=dba;PWD=sql" -y

PAUSE Wait until the database is stopped, then

ERASE /F ddd12.db
ERASE /F *.log
ERASE /F dbsrv12_log_ddd12.txt
ERASE /F dbsrv12_log_fatal_ddd12.txt
RMDIR /S /Q backup