Download 10 Administration

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microsoft Access wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Serializability wikipedia , lookup

Oracle Database wikipedia , lookup

IMDb wikipedia , lookup

Btrieve wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Functional Database Model wikipedia , lookup

Relational model wikipedia , lookup

Database wikipedia , lookup

Ingres (database) wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Concurrency control wikipedia , lookup

Versant Object Database wikipedia , lookup

Database model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Clusterpoint wikipedia , lookup

ContactPoint wikipedia , lookup

Transcript
Administration etc.
What is this ?
• This section is devoted to those bits that I could not find
another home for…
• Again these may be useless, but humour me!
• We will cover
– BACKUP
– SP_IQCHECKDB
– DBCC options
– Some other Stored Procedures
Backup
• Three Types of Backup
– FULL backup
– INCREMENTAL backup
– INCREMENTAL-since-FULL backup
• All will backup the IQ Store and the Catalogue Store
• The IQ Temporary Store is never backed up
Backup Types
• FULL causes a full backup of the Catalogue and IQ
Stores
• INCREMENTAL makes a full backup of the Catalogue
Store, and backs up all changes to the IQ Store since
the last IQ backup of any type
• INCREMENTAL SINCE FULL makes a full backup of
the Catalogue Store, and backs up all changes to the IQ
Store since the last FULL IQ backup
Backup Processing
Trans.
Log
Catalog
Store
IQ Store
• Backup backups committed
data only
1.
Issue Checkpoint
4.
Write (Changed) Data
To Tape(s)
2.
Write Marker into Log
3.
Write Catalog to Tape(s)
5.
Write Marker into Log
6.
Check for Completed TX.
7a.
If there are – backup the changed pages
Then go to 5.
Tape Drive(s)
7b.
If there are no committed TX
Checkpoint,Delete Log and Stop
– Backup begins and ends
with a checkpoint
– Any data that is committed
during the backup process
will be included in the
backup
– The transaction log is not
backed up, it is deleted after
a successful backup
Transaction Log
• The log is deleted or renamed after a backup completes
– Not needed for a Restore
• If there are ASA tables in the catalog store (other than
system tables) you must retain the log to recover
transactions for this data
Restore
• Before Restore
– You must have dba authority
– No users on the database
– The database server must be running
• To ensure exclusive access start the server with the -gd
option (-gd dba)
Restore Restrictions
• For incremental restores there must be no user access
between restores
• Restore will create and drop dbspaces as required
When to do Restores
• If the database is corrupt - you must do a restore
• If the last backup was FULL restore the FULL backup
only
• IF you have an INCREMENTAL SINCE FULL backup
that precedes the database failure then restore the
FULL followed by the INCREMENTAL SINCE FULL
Check DB
• The routine to check the database for potential
corruptions is SP_IQCHECKDB
• There are no run-time options for this command,
however the DBCC options control the behavior of the
SP_IQCHECKDB command
• Also there are some (2) server startup switches that
affect the performance and behavior of SP_IQCHECKDB
Normal Checkdb Performance
• If none of the defaults are set SP_IQCHECKDB
– checks ALL of the allocated pages in the database
– Traverses all of the index chains (and checks the reverse
addresses)
– Reports any errors found
– If no errors are found then the free list is updated
• This last point is moot – if there are no errors, then the
free list is OK – but well…
Checkdb Output
DB Statistics
Value
---------------------------------- ------IQ DBCC Verification Summary
Total Blocks In Database
Blocks Marked as In Use
Blocks Verified as In Use
Blocks Detected as Duplicates
Blocks Detected as Unowned
Blocks Detected as Leaked
Tables Verified
Indexes Verified
Join Indexes Verified
20480
1026
1026
0
0
0
9
74
0
Flags
-------
Checking the database
• There are 3 procedures that check the system “metadata” in
addition to SP_IQCHECKDB
• These are
– SP_IQDBSIZE
– SP_IQTABLESIZE
– SP_IQINDEXSIZE
• These procedures not only report on sizes, they check on the
objects, and will fail if there is an error
• At this point the procedure SP_IQCHECKDB should be executed
Warning
• Just because the procedures execute cleanly does not guarantee
that the object is clean, but it is a good quick check
• If you suspect there is corruption in the database you should run
SP_IQCHECKDB first
• But this will take time
• If SP_IQCHECKDB finds corruption then run the other procedures
to try and localize the corruption – or run SP_IQCHECKDB with the
fix options on
Force_Drop
• The FORCE_DROP option will allow a dba to drop a
corrupted object (index or table)
• The space used by the object will not be recovered
• To recover the space the server should be started with
the –iqfrec and –iqdropblks switches
Server Switches
• The switch –iqfrec will mark the database as clean
(may not be what you want!) and allow you to try and
drop any corrupted objects
• The switch –iqdroplks sets an option in SP_IQCHECKDB
to allow the collection of dropped blocks
– Effectively this rebuilds the free list
DBCC_OPTION - 1
• The Option DBCC_OPTION controls the action of
SP_IQCHECKDB when problems are encountered
• Value are 0 thru 7, default is Zero
DBCC_OPTION - 2
Value
0
Action
Value
Action
If –iqdropblks is set this checks for leaked
blocks and corrupt pages – if there are no
errors the free list is rebuilt – if there are
errors then the error list is reported, but no
action is taken
3
Server must have –iqdropblks set. Checks
leaked blocks (same as 0 and –iqdropblks
but only checks leaks
4
Checks page chaining on all indexes
If –iqdropblks is not set then if an error is
found the server (probably) will terminate
5
Full chain and consistency check on all
indexes, not just the index chaining (This
can be slow)
6
Full consistency check on all indexes, and
will try to repair broken chains
7
A more detailed version of 6 - more
through but very much slower.
1
Fast leak check – walks the block maps
only. This
is very fast (1-2 GB per second)
2
Checks for leaked blocks and corrupt
pages/chains. Runs at around 50Mb to
100Mb per second. This is the same as 0
when –iqdropblks is set
SP_IQDBSTATISTICS
• This procedure (used to) give(s) a more detailed map of
the storage in the database
• Now (12.4) and with 12.4.2 this information is present
in the SP_IQCHECKDB output
Sizing the database
• There are a series of sizing stored procedures
• I am not going through them – you can read as well as I
can
• One minor issue – if the IQ_PageSize is different to the
default the estimated sizes will be wrong!
Server/Database information
• Everyone knows sp_iqstatus
• But also try
– sa_conn_properties – this does not just display the options
list - there is a set of almost useful counters at the front of
the report
– sa_db_properties -this gives you the database related
information – again sometimes useful
– sa_eng_properties – this returns the engine related data
Sp_IQStatus
Adaptive Server IQ (TM) Copyright (c) 1992-1999 by Sybase, Inc. All rights reserved.
Version:
12.4.0/(32bit mode)/MS Windows NT 4.0/EBF
0009
Time Now:
2000-03-03 17:20:33.123
Build Time:
Jan 13 2000, 03:38:09
File Format:
22 on 10/29/1998
Catalog Format:
2
Stored Procedure Revision:
1
Page Size:
1024/512blksz/2bpc
Number of DB Spaces:
1
Number of Temp Spaces:
1
DB Blocks: 1-20480
IQ_SYSTEM_MAIN
Temp Blocks: 1-10240
IQ_SYSTEM_TEMP
Create Time:
1999-08-09 16:00:11.629
Update Time:
1999-08-09 16:00:26.285
Main IQ Buffers:
6393, 8Mb
Temporary IQ Buffers:
3196, 4Mb
Main IQ Blocks Used:
1026 of 20480, 5%, Max Block#: 1205
Temporary IQ Blocks Used:
13 of 10240, 0%, Max Block#: 0
Memory:
Current: 13mb, Max: 14mb
Main IQ Buffers:
Used: 12, Locked: 1
Temporary IQ Buffers:
Used: 6, Locked: 0
Main IQ I/O:
I: L27/P12 O: D4/P1 C: D432960288
Temporary IQ I/O:
I: L32/P0 O: D6/P0 C: D0
Sa_conn_properties
Number
1091288617
1091288617
1091288617
1091288617
1091288617
1091288617
1091288617
1091288617
Etc…
PropNum
29
30
31
32
33
34
35
36
PropName
CacheHits
CacheRead
DiskRead
DiskSyncRead
DiskWaitRead
DiskWaitWrite
CacheReadTable
CacheReadIndLeaf
PropDescription
Cache hits
Cache reads
Disk reads
Disk synchronous reads
Disk wait for reads
Disk wait for writes
Cache table reads
Cache index leaf reads
Value
0
0
12
0
0
0
0
0
Sa_db_properties
Number
0
0
0
PropNum
125
126
127
PropName
Name
Alias
File
0
0
128
129
PageSize
LogName
0
0
0
0
0
0
0
0
131
146
147
148
151
163
164
165
ConnCount
FileVersion
CheckpointUrgency
RecoveryUrgency
IQStore
CharSet
MultiByteCharSet
Language
PropDescription
Value
Database name
asiqdemo
Mounted database name
asiqdemo
Database file
C:\Program Files\Sybase\ASIQ12\demo\asiqdemo.db
Database page size
4096
Database log file name
C:\Program Files\Sybase\ASIQ12\demo\asiqdemo.log
Number of connections
2
Database file version number
1001
Database checkpoint urgency
0
Database recovery urgency
0
IQ store is on/off
ON
Character Set
cp1252
Multi Byte Character Set ( on/off ) OFF
Language
unknown
Sa_eng_properties
PropNum
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
PropName
IdleCheck
IdleWrite
IdleChkpt
IdleChkTime
Chkpt
ChkptPage
ChkptFlush
ExtendDB
ExtendTempWrite
FreeWritePush
FreeWriteCurr
CommitFile
PendingReq
CurrRead
MaxRead
CurrWrite
MaxWrite
CurrIO
MaxIO
JavaNSSize
IOToRecover
PropDescription
Idle I/O checked
Idle I/O writes
Idle I/O checkpoints
Idle I/O checkpoint time
Checkpoints
Checkpoint log pages
Checkpoint flushed pages
Extend database file writes
Extend temporary file writes
Free list write to pushable list
Free list write to current list
Commit writes to disk
Pending requests detected
Active disk read requests
Maximum active disk read requests
Active disk write requests
Maximum active disk write requests
Active disk read/write requests
Maximum active disk read/write requests
Java VM Namespace size
Value
0
0
0
0
1
2
2
0
66
0
0
347
0
0
2
0
2
0
2
0
0
Administration - End