Contenu connexe Similaire à Novell ZENworks Configuration Management Database Management (20) Novell ZENworks Configuration Management Database Management1. Novell ZENworks ® ®
Configuration Management
Database Management
Aaron Dockter
Software Engineer
Novell, Inc. /adockter@novell.com
2. Introduction
“The typical DBA life is like that of an airline
pilot, 'Long moments of boredom followed by
small moments of sheer terror.'”
Excerpt from "Easy Oracle Jumpstart" by Robert Freeman and Steve Karam
(Oracle ACE and Oracle Certified Master),
http://www.dba-oracle.com/concepts/starting_database.htm
2 © Novell, Inc. All rights reserved.
3. Objectives
Raise awareness: A good database strategy is essential
in the planning and implementation of a
Novell ZENworks Configuration Management zone.
® ®
Increase understanding of the tools available: There are
many tools that can be used to help manage the Sybase
SQL Anywhere database.
– Backup and Recovery tools
– Maintenance, Tuning and Troubleshooting tools
Demonstrate: In order to keep the database healthy, a
system administrator must be sure the database is
updated and rebuilt properly.
3 © Novell, Inc. All rights reserved.
5. Database Considerations
• How do you know which
database is right for you?
• Do you have a DBA for
maintenance of an Oracle or
Microsoft SQL server?
• Do you have budgetary
constraints?
• How many applications,
Primary Servers, Satellite http://www.novell.com/documentation/zcm10/
Server, and total devices will
you have?
• Which products do you intend
to leverage?
5 © Novell, Inc. All rights reserved.
6. Database Considerations
(cont.)
• How much disk space do you
Database Sizing (Upper Limit)
need?
• It is a complex calculation 140
based upon many factors, the 120
primary factors are 200
100 300
– Number of users 400
500
Devices + Users
80
Size in GB
1000
– Number of devices 60
2000
4000
6000
– Products you are using 40 10000
20000
(Novell ZENworks Novell
® ® ®
20 40000
ZENworks Patch ®
0
Management, ZENworks 100
Asset Management, BOE, Bundles
etc.)
6 © Novell, Inc. All rights reserved.
7. Database Considerations
(cont.)
12
Database Sizing
10
1000
900
8
200
800 300
400
Devices + Users
700 500
Column 1
6
1000
Column 2
2000
Column 3
600
4000
Bundles
6000
4 500
10000
20000
400 40000
2 300
200
0 100
Row 1 Row 2 Row 3 Row 4
0 20 40 60 80 100 120 140 160
Size in GB
7 © Novell, Inc. All rights reserved.
8. Query Performance
Database Engine choice
> Sybase SQL Anywhere will not perform as well as Oracle or
Microsoft SQL Server using the complex queries provided by
the database framework that Novell ZENworks Configuration
® ®
Management uses.
WAN connections to the database:
> Avoid database communication over WAN links
> Have primary servers located as close to the database as
possible
Note: Satellite servers do not talk to the database directly
8 © Novell, Inc. All rights reserved.
9. Query Performance
Database specific factors:
> Number of columns and rows in a table
> Table joins / Query complexity (zContent)
> Fragmentation
> Resources available (Embedded vs. External)
9 © Novell, Inc. All rights reserved.
10. Embedded vs. External
• Embedded Database
– SQL Anywhere 10.0.1
– Installed by default with Novell ZENworks Configuration
® ®
Management
– OEM License for use with ZENworks
– Shares resources with Primary Server
• External Database
– Can be OEM version of Sybase SQL Anywhere
– Dedicated database hardware for ZENworks Configuration
Management
http://www.novell.com/documentation/zcm10/
10 © Novell, Inc. All rights reserved.
12. Backing Up Your Database
It's too late to backup
your database if...
– The dbsrv10 process is
crashing periodically.
– The database service won't
start.
– Your database server
crashes irrecoverably
– Your fire alarm goes off in
your data center and the
door knob is hot.
12 © Novell, Inc. All rights reserved.
13. Backing Up Your Database
(cont.)
• Make sure you have your database password
– On your primary server, to get the database password, run:
zman dgc
– Save the password in a secure place for future use
13 © Novell, Inc. All rights reserved.
14. Full vs. Incremental Backups
Full
– Makes a copy of both the database and the transaction log.
– Easy to restore/recover the database
– Can be expensive in terms of disk space
– Safer
– Truncate the transaction log to reduce size on disk
– You may choose whether to do an
> 'Archive' backup - database + transaction log in one file, or
> 'Image' backup - database and transaction logs backed up
separately.
http://tldp.org/HOWTO/Sybase-ASA-HOWTO/backup.html
14 © Novell, Inc. All rights reserved.
15. Full vs. Incremental Backups
(cont.)
Incremental
– Makes a copy of the transaction log only
– Use dbtran to apply the transaction log to the database
– Potential for data loss if the log is corrupted
http://tldp.org/HOWTO/Sybase-ASA-HOWTO/backup.html
15 © Novell, Inc. All rights reserved.
16. Online vs. Offline Backups
Online Backup
– Done without stopping the database server
> 'zman database-backup <path to backup directory>'
– High availability
– Slower.
> Use “SET TEMPORARY OPTION BACKGROUND_PRIORITY =
'ON';”
– Can use incremental backup (transaction logs only) or full backup
http://tldp.org/HOWTO/Sybase-ASA-HOWTO/backup.html
16 © Novell, Inc. All rights reserved.
17. Online vs. Offline Backups
(cont.)
Offline Backup
– Can use a scheduling mechanism to shutdown the database
> Windows Task Scheduler, crontab, etc
– Can use incremental backup (transaction logs only) or full backup
– Lends itself better to do a full backup quickly
http://tldp.org/HOWTO/Sybase-ASA-HOWTO/backup.html
17 © Novell, Inc. All rights reserved.
18. Backup Strategy
How do I create an effective strategy?
• Incremental backups: more frequent
• Full backups: regular intervals, but less frequent
• Online backups: use for the incremental backups
• Offline backups: use with full backups at less frequent intervals
Tips:
• Backup your database after every server update
• Make sure your database back has the same name as your current database
• Check and double-check your disk space, this can impact the best strategy for you
backup.
• Events and notifications can be scheduled through the database server itself.
• (See p. 800, Understanding Schedules,
http://www.ianywhere.com/developer/product_manuals/sqlanywhere/1001/en/pdf/db
daen10.pdf)
18 © Novell, Inc. All rights reserved.
19. Database Backups
➢ Use the 'ZMAN' Command: The ZMAN command does a full
online backup, and truncates the transaction log. This can be
leveraged in your backup strategy.
➢ BACKUP DATABASE DIRECTORY '<backupDirectory>'
TRANSACTION LOG TRUNCATE
➢ Use Sybase Central: Starting in the Sybase that ships with 10.3
(also available as an FTF), you can start using Sybase Central.
%ZENWORKS_HOME%shareASASybase Central 5.0.0win32scjview.exe
/opt/novell/zenworks/share/sybase/bin32s/sybcentral500/scjview
➢ Backup Server Content: It is not just your database that counts,
the data in the content repository, certification information, and
other recommended files should be backed-up. The database will
reference some of that information, so redundancy is a must.
19 © Novell, Inc. All rights reserved.
20. Database Validation
• Validate the database
before and after backups
– Maintains database integrity
– Does not check Novell ®
ZENworks Configuration
®
Management schema
– Can be run from Sybase Central
– Can be run from the command
line
dbvalid -c
“UID=zenadmin;PWD=<password>;
ENG=<database service name>”
20 © Novell, Inc. All rights reserved.
21. Database Validation
(cont.)
What to do if a validation failure occurs?
1) Try unloading the database
2) Restore your “last known” good backup.
21 © Novell, Inc. All rights reserved.
22. Database Recovery
• Identify the problem: Depending on your database problem you
will have to determine the best recovery strategy
• Recover the database offline: Make sure that the database is
stopped and that all primary server services are stopped so that
the services cannot reach the database.
• Use One of Two Methods:
– Apply the good transaction log(s) to the last full backup copy of
your database. (Sybase has a utility called 'dbtran' for this
purpose.)
– Restore the last GOOD backup of your database by copying it in
place
22 © Novell, Inc. All rights reserved.
24. Tuning and Maintenance
How to increase the performance of your database:
1.Change your Startup Options
2. Increase your cache size or set your minimum cache size to a
larger value.
3. Place your transaction log on a separate drive from the database
file. (I/O Competition)
4. Use a RAID device
5. Rebuild your database (fragmentation)
http://www.sybase.de/detail?id=1023801
24 © Novell, Inc. All rights reserved.
25. Tuning - Transaction Log Location
• Stop the Database: Make sure the database service is stopped.
• Execute the command:
dblog -t <location of new transaction log> <path to database>
• Don't lose the log: Once the transaction log is moved, make
sure that it is still included in any offline backups you make.
25 © Novell, Inc. All rights reserved.
26. Tuning - Database Location
• Move the database file: The database file can also be moved by
simply changing the path in the zenworks_database.conf file.
• Use a RAID: A simple RAID device may be a good choice for
hosting the the database and transaction log.
Note: 'dbspaces' are another method to increase performance.
For Novell ZENworks Configuration Management support, we
® ®
recommend not using such a complex structure.
26 © Novell, Inc. All rights reserved.
27. Startup Options
– Changing Default Options: The zenworks_database.conf file
contains all of the database server startup options (dbsrv10
@zenworks_database.conf)
> Linux: /etc/opt/novell/zenworks
> Windows: %ZENWORKS_HOME%conf
– Enable Debug Logging: This is where debug logging can be
enabled as well as other tuning options.
http://www.ianywhere.com/developer/product_manuals/sqlanywhere/1001/en/html/dbdaen10/da-dbengines.html
27 © Novell, Inc. All rights reserved.
29. Startup Options
• Increase cache size: Modify the cache size by changing '-c 8M' to
a value more aligned with your environment.
• Set a minimum cache size: Instead of using '-c' option, set the
minimum cache size using '-cl'.
• Other Options:
– Change the checkpoint interval (-gc option)
– Set the maximum number of physical processors to use.
(-gt option)
29 © Novell, Inc. All rights reserved.
30. Enabling Debug Logs (basic)
• Modify the
zenworks_database.conf
located at:
%ZENWORKS_HOME%conf
/etc/opt/novell/zenworks
• Add options:
-os 50M (size of log file for
messages)
-o <location>
• For custom logging include
the '-zr' option
– Can set options specific to the
types of statements you are
debugging
http://www.ianywhere.com/developer/product_manuals/sqlanywhere/1001/en/html/dbdaen10/da-dbengines.html
30 © Novell, Inc. All rights reserved.
31. Enabling Debug Logs (verbose)
• Add options:
-zs 50M (size of request logging)
-os 50M (size of log file for
messages)
-zr all (log sql operations)
-z (connection diagnostics)
-zt (timing information)
-o <location>
When logging is enabled, be sure to pay attention to log sizes
as well as disk space consumed.
http://www.ianywhere.com/developer/product_manuals/sqlanywhere/1001/en/html/dbdaen10/da-dbengines.html
31 © Novell, Inc. All rights reserved.
32. Debug Log Output
(Blue) Database
fragmentation warnings
(Green) Loading
transaction log
(Red) Database server
starts
32 © Novell, Inc. All rights reserved.
33. Debug Log Output
(cont.)
Typical transaction output shown
33 © Novell, Inc. All rights reserved.
34. Performance Monitoring
Sybase SQL Anywhere comes with built-in performance
monitoring capabilities.
34 © Novell, Inc. All rights reserved.
37. Performance Monitoring
(cont.)
• Reports on such things as:
– deadlock information
– CPU usage
– trigger and stored procedure
efficiency
– queries being executed
– query run times
• Longer profiling times provide
greater accuracy (at the risk of
responsiveness)
37 © Novell, Inc. All rights reserved.
40. Logs to Provide To Support
• Should you encounter problems with
your database, please provide the
following information:
– The output from the log file enabled
and specified in the
zenworks_database.conf file.
– The version of the database you are
running (The Sybase tool 'dblocate'
will provide that information when run
from a command prompt).
– The transaction log and approximate
time of the issue
– The date of your last backup
• Sybase Central has an easy to use
interface for acquiring deadlock
information, connection, information, and
even profiling statistics.
40 © Novell, Inc. All rights reserved.
41. Logs to Provide To Support
(cont.)
• You can enable more verbose logging through 'dbisql' by executing the following:
call sa_server_option('RememberLastStatement','ON');
call sa_server_option('RememberLastPlan','ON');
call sa_server_option('CacheSizingStatistics','Yes');
set option PUBLIC.Log_Deadlocks = 'ON';
• When the problem occurs run the following commands and collect the logs:
select NOW(),* from sysoptions;output to 'sysoptions.txt' append; commit;
select NOW(),* from sa_locks();output to 'sa_locks.txt' append; commit;
select NOW(),* FROM sa_eng_properties();output to 'sa_eng_properties.txt' append;
commit;
select NOW(),* from sa_conn_info();output to 'sa_conn_info.txt' append; commit;
select NOW(),* from sa_conn_properties();output to 'sa_conn_properties.txt' append;
commit;
select NOW(),* from sa_report_deadlocks();output to 'sa_report_deadlocks.txt' append;
commit;
41 © Novell, Inc. All rights reserved.
42. Fragmentation
• Rebuild: After any major updates or significant changes to Management
Zone
– System Update
– Patch Management Enabled
– Adding lots of devices
– Adding lots of bundles (or bundles with lots of content)
– Consists of either unloaded all data to a new database or to .dat files for use in
reloading into a new database
• Reorganize Tables: If the database is severely fragmented in specific
tables (REORGANIZE TABLE <table name>;)
1. Clean up the zMessage table frequently, as this is a major source of
fragmentation
2. zObjectInfo, zStatusEvent tables may need to be defragmented more
frequently
42 © Novell, Inc. All rights reserved.
50. Rebuilding the Database –
Command-line
• Using 'dbunload' command
– Unload into a new database:
dbunload -c "UID=zenadmin;PWD=<database password>;ENG=<database service name>"
-an "<path to new db>"
– Unload database definitions into .dat files and reload
dbunload -c "UID=zenadmin;PWD=<database password>;ENG=<database service name>"
"<path to unload directory>"
dbinit -p 4096 <path to new db>
dbisql -c "UID=DBA;PWD=sql;DBF='<path to new db>'" read reload.sql
50 © Novell, Inc. All rights reserved.
51. Updating the Database Engine
• Emergency Bug Fixes (EBF): Sybase has a list of all critical
fixes since the last EBF.
– http://origin1.sybase.com/swx/12952/rdme_1001_ebf_3974.html
• Download Packages: As the Emergency Bug Fixes are
released, we will package required EBFs and provide them as
downloads on our website.
– For 10.2.x, update using the FTF at:
http://download.novell.com/protected/Summary.jsp?buildid=JhOYPc1Q5Tc~
• System Update: Sybase packages will no longer be
automatically updated after ZCM 10.3 because an offline rebuild of
the database is required after applying any EBF.
51 © Novell, Inc. All rights reserved.
52. Virtual vs. Physical Host
Virtual Database Host
– While it is easier to manage backups, many times the database
is setup on a Virtual host in hopes to save cost. However, the
cost that is incurred is performance.
> If the resources are pooled for other machines/servers, the database is in
competition
> Inherently slower I/O and response time with added layer
Physical Host
– With a physical host the resources are dedicated and more
responsive. In a Novell ZENworks Configuration Management
® ®
zone, responsiveness is everything.
52 © Novell, Inc. All rights reserved.
53. Database Mirroring
Sybase SQL Anywhere supports database
mirroring
– Use as a method to implement high availability
– Fault tolerant
– Requires multiple database servers
– Mirroring should not be implemented as a
means to distribute the database work to remote
locations
– Mirrored servers should be connected over high
speed link
– Not setup by default with Novell ZENworks ® ®
Configuration Management
http://www.ianywhere.com/developer/product_manuals/sqlanywhere/1000/en/html/dbdaen10/da-da-highavailability-s-4980336.html
53 © Novell, Inc. All rights reserved.
54. General Tips
• Avoid leaving the 'dbisql' query runner utility open for extended
periods of time as it may lock tables until it is closed
(especially verbose logging).
• Make sure you have a reliable backup of a production system
before experimenting with the tools available.
• Try installing the Sybase MSI/RPM on a separate
administrative machine for managing the database.
– Must be on same network
– Use to reduce load on database server
• You can setup stored ODBJ connections to the Sybase SQL
Anywhere database
54 © Novell, Inc. All rights reserved.
56. Links
• Getting the latest sybase packages.
• http://download.novell.com/protected/Summary.jsp?buildid=JhOYPc1Q5Tc~
Sybase Reference Documenation
•http://www.ianywhere.com/developer/product_manuals/sqlanywhere/1001/en/pdf/dbdaen10.pdf
•http://www.ianywhere.com/developer/product_manuals/sqlanywhere/1001/en/html/
•http://www.ianywhere.com/developer/product_manuals/sqlanywhere/1001/en/html/dbdaen10/da-dbengines.html
Sybase Physical Limitations
•http://www.ianywhere.com/developer/product_manuals/sqlanywhere/1001/en/html/dbdaen10/da-lt-size.html
Rebuilding the database
•http://realworlddba.wordpress.com/2008/02/04/index-rebuild-versus-reorganize-whats-the-difference/
•http://breckcarter.sys-con.com/node/107002/mobile
http://www.novell.com/documentation/zcm10/zcm10_system_admin/?page=/documentation/zcm10/zcm10_system_admin/data/bmjef9k.html#bmjenfz
•
Automated Database Backup
•http://iablog.sybase.com/hinsperg/2009/02/automated-database-backups/
•http://www.novell.com/documentation/zcm10/zcm10_system_admin/data/bjm5wmx.html
• Increase your Database Performance
• http://www.sybase.com/detail?id=1023801
56 © Novell, Inc. All rights reserved.
57. Links
(cont.)
Backup Syntax and Help
http://www.ianywhere.com/developer/product_manuals/sqlanywhere/1001/en/html/dbrfen10/rf-backup-statement.html
Setting up Mirroring (High Availability)
http://www.ianywhere.com/developer/product_manuals/sqlanywhere/1000/en/html/dbdaen10/da-da-highavailability-s-4980336.html
Changing the location of the transaction log
http://dcx.sybase.com/1100en/dbadmin_en11/changing-log-location-backup.html
Moving to dbspaces
http://m.sybase.com/detail?id=1011479
Database Startup Options
http://www.ianywhere.com/developer/product_manuals/sqlanywhere/1001/en/html/dbdaen10/da-dbengines.html'
• Location of Sybase Bug Fixes
• http://origin1.sybase.com/swx/12952/rdme_1001_ebf_3974.html
Other Sites
•http://www.dba-oracle.com/concepts/starting_database.htm
•http://tldp.org/HOWTO/Sybase-ASA-HOWTO/backup.html
Backing up the database using ZMAN
•http://www.novell.com/documentation/zcm10/zcm10_system_admin/?page=/documentation/zcm10/zcm10_system_admin/data/bo118v1.html
•http://www.novell.com/documentation/zcm10/zcm10_system_admin/?page=/documentation/zcm10/zcm10_system_admin/data/ban0rcu.html
Sybase Central
http://m.sybase.com/files/Product_Overviews/iAS_techdoc_sa10_command_line_utilities_1054563.pdf
Performance Monitoring
http://www.sybase.com/detail?id=1023801
57 © Novell, Inc. All rights reserved.
60. Unpublished Work of Novell, Inc. All Rights Reserved.
This work is an unpublished work and contains confidential, proprietary, and trade secret information of Novell, Inc.
Access to this work is restricted to Novell employees who have a need to know to perform tasks within the scope
of their assignments. No part of this work may be practiced, performed, copied, distributed, revised, modified,
translated, abridged, condensed, expanded, collected, or adapted without the prior written consent of Novell, Inc.
Any use or exploitation of this work without authorization could subject the perpetrator to criminal and civil liability.
General Disclaimer
This document is not to be construed as a promise by any participating company to develop, deliver, or market a
product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in
making purchasing decisions. Novell, Inc. makes no representations or warranties with respect to the contents
of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any
particular purpose. The development, release, and timing of features or functionality described for Novell products
remains at the sole discretion of Novell. Further, Novell, Inc. reserves the right to revise this document and to
make changes to its content, at any time, without obligation to notify any person or entity of such revisions or
changes. All Novell marks referenced in this presentation are trademarks or registered trademarks of Novell, Inc.
in the United States and other countries. All third-party trademarks are the property of their respective owners.