To provide a stable and highly available database environment, along with planning backups and performing recoveries and all the other maintenance tasks, DBAs are usually exploring how t
Trang 1D atabase administrators (DBAs) have significant responsibilities.They must not only provide reliable access to company data,
but also protect that data, monitor the database environment, troubleshoot problems, and more If the lives of DBAs were simple, what fun would that be? That is probably why
I enjoy the job so much—because of the different opportunities and challenges that I get to face day to day
To provide a stable and highly available database environment, along with planning backups and performing recoveries and all the other
maintenance tasks, DBAs are usually exploring how to use new features, and even learning multiple database platforms Yes, I said it: as a DBA, you probably need to know more than one database platform The days of being just an Oracle or SQL Server DBA are probably gone Companies are
adopting more than one database platform, and applications may import or export data from one database system to another But why am I telling you this? You have already decided to add Oracle to your arsenal The big question is, How hard will this be?
If you are a SQL Server DBA, you don’t need to start back at square one
to support Oracle databases Certainly, there are differences between the platforms, but many of the DBA tasks are basically the same You can apply the skills you already have to learning Oracle, using this book as your guide This book will even translate terms from SQL Server to Oracle,
because sometimes being able to speak the language is half of the battle Before we look into the specifics of Oracle, in this chapter, we will review the role of the DBA, so you can see how to leverage the skills you already have as you learn the new database platform We will also look briefly at the migration process
General DBA Skills
The role of the DBA is more than just backing up the database and making sure the database is available There are several hats that are worn by a DBA—from tuning queries to server configuration, as well as making sure the database is secure
Here are some of the tasks a DBA performs:
■ Installing databases
■ Backing up and restoring databases
Trang 2■ Coding and tuning SQL statements
■ Monitoring space and growth
■ Establishing best practices
■ Configuring highly available environments
■ Developing security strategies
■ Performing maintenance tasks
On a given day, a DBA may need to validate backups, handle some
support issues, add users, and possibly roll out some new code to the
production database Some days may be spent just troubleshooting
performance, tuning code, or working on the database model Even if the production database might not need to be restored on a regular basis (a very good thing!), a test environment may need to be refreshed frequently Being able to resolve an issue as quickly as possible is important, which may
require research and drilling through database logs and trace files
Other general skills for a DBA might include managing projects and
creating and following processes DBAs are not working in an environment where only one person is accessing the database system The database is normally supporting enterprise-level applications with many users and
various workloads
Software vendors have stated that installing databases and monitoring them are simple tasks, but somehow there seems to be more moving parts these days Also, new areas, such as compliance and business intelligence, provide different challenges for DBAs
The DBA may have the responsibility to back up databases and restore and copy them into another environment The DBA may be required to
design the database model and coding procedures A DBA may even be
more of an enterprise architect, who knows how to use data at an enterprise level to support the business and add value through business intelligence solutions This type of role would also involve assessing if the right tool is being used, understanding the differences in platforms, and managing these
to help make better design decisions
Trang 3Where Do DBAs Belong
in an Organization?
Are DBAs in production support, the architecture team, the engineering team, or the development team? Actually, they could probably be a part of all these teams or in a separate group altogether But in any case, they still need to work with all the teams
DBAs work with system administrators for configuring operating systems and providing input to hardware decisions for the environment DBAs work with developers to design systems and provide coding standards and best practices for developing applications that use databases DBAs work with networking and interface teams for connections and hooks into the
database DBAs work with users, operations, and anyone else who needs access to the database DBAs are considered to be experts in the area of databases, and they are expected to know enough information in other areas to be able to support and communicate needs for the database
environment Some DBAs may even be considered engineers instead of administrators, which implies more of a design and architecture type of role than production support
Depending on the size of the company and number of databases, there might be one DBA who does it all, or separate DBAs, such as a system DBA,
an application DBA, a development DBA, and an architecture DBA In following compliance regulations, the separation of these roles for the DBAs
is becoming more important
Just as application developers shouldn’t have access to the production system, the development DBA may just be working in the development space, and passing scripts to production support DBAs for execution The development DBA could be working with the developers on the design of the database application, developing the data model and data flows The role might involve looking at performance and coding SQL, as well as seeing how best to implement new features
The system DBA will concentrate on backups, space monitoring, and maintenance jobs like reviewing statistics and rebuilding indexes This DBA would probably be the one who provides production support and runs prepared scripts for changing objects or implementing upgrades
The roles for DBAs also depend on whether applications are developed in-house or third-party applications are running in the environment
Trang 4Database Installation Planning
Several pieces need to be coordinated and communicated to install and
upgrade databases Basic installations wouldn’t need much planning if we were just installing software on a desktop somewhere and the application was used by just one person Also, an organization will probably need more than just one database, so a repeatable process would be useful
DBAs need to manage installations to be able to communicate needs to other teams for hardware and operating system configurations They must get details about the application to make sure that the database has the
features needed Properly managing database installations is important for planning upgrades and implementing enterprise monitoring systems On a smaller scale, this planning is useful for patching, making changes to
security configurations, and rolling out auditing tools Developing standards and building a process will create a more consistent and stable database
environment
When installing SQL Server, you can choose where to put data files and log files, if the instance is the default unnamed or named instance, which patch set is to be applied, if Reporting Services and Analysis Services are to
be installed, and so on You probably have a checklist so that a standard
installation can be repeated on multiple databases Creating a checklist or standard installation document is just as important for Oracle databases
Instance names, parameters that should be set, components that should be installed, Oracle home directories, directories for data files and log files, as well as recovery areas, should all be included Table 1-1 shows high-level checklists for preparing to install SQL Server and Oracle databases Notice that many of the same tasks are listed for both platforms (Chapter 3 covers Oracle installation in detail.)
Leveraging Skills
We’ve reviewed some general DBA skills and practices, which you are
probably currently applying to support the SQL Server system you are
managing Now let’s look at how these skills provide a starting point for
learning Oracle
Trang 5Table 1-2 compares the skills needed for managing SQL Server databases with those required for managing Oracle databases
You probably expected that these tasks and skills are needed no matter which database platform is being supported and managed The trick is discovering the differences, such as new best practices, variations in
features, and differences in syntax for these tasks in Oracle This way, you can distinguish what you already know from what you need to learn
For example, whether the database is Oracle or SQL Server, part of the DBA’s job is to make sure things are backed up properly, including having a strategy for the types of backups required Recovery and restore procedures are also part of this strategy You already understand general backup concepts You know that you want transaction log backups and to be able
to recover up to a point in time, as you’ve set up in SQL Server Now you need to know the details of backup and restore options in Oracle For example, to create a backup in SQL Server, you execute a backup database command; in Oracle, using the RMAN utility, you execute a backup
database command—that’s simple enough, right?
Obtain software and release notes Obtain software and release notes Configure Windows, memory, etc Validate operating system
configuration Set up domain account and
privileges
Create user for installing Oracle and processes (other users might be needed for other components) Allocate storage Allocate storage
Configure network Configure network
Install software Install software
Validate install Validate install
Back up system, excluding mdf
and ldf files
Back up system, excluding data files
TABLE 1-1. SQL Server and Oracle Installation Checklists
Trang 6System monitoring is another example Understanding why certain areas need to be monitored for better-running databases is half of the battle If you know the information you want to monitor, then you just need to find out how to do it in Oracle Knowing which areas to check comes from the
experience of dealing with databases and troubleshooting issues in the past Performing health checks against the database and reviewing database logs are good first steps
Health checks are not just looking into current issues, but also monitoring several areas and verifying that databases are running well Health checks in SQL Server could be verifying if jobs are running properly, checking disk
space, reviewing last-analyzed-for statistics, making sure old backups have been purged, and running other monitoring scripts Oracle’s high-level list of health checks include validating backups, checking available space in
tablespaces and file systems, making sure statistics are up to date, and
verifying that other scripts are running and completing as expected
Disaster recovery planning X X
Performance tuning X X
Developing standards and best practices X X
Implementing security X X
Capacity planning X X
Managing projects X X
TABLE 1-2. SQL Server and Oracle Skill Sets
Trang 7The home page of Oracle Enterprise Manager, shown in Figure 1-1, provides a quick look at the status of the database It shows if the database
is up or down, a list of errors in the alert log, and general server information about CPU and active sessions Checking system-level resources, such as CPU and memory usage, in a Microsoft Windows system is probably
already part of your SQL Server health check routine Knowing that these details are available in Oracle Enterprise Manager gives you a good place to start You’ll learn more about Oracle Enterprise Manager in Chapter 5
If you have scripts created in Perl or another programming language to monitor and manage SQL Server, these scripts can be leveraged to create similar scripts for Oracle Having such scripts is a great start
FIGURE 1-1. Oracle Enterprise Manager home page
Trang 8Database Migrations
You might need to learn Oracle because your company’s current database will be converted from SQL Server to Oracle There are various ways to
migrate, but all begin with a solid plan The options available have varying inputs and outputs, as well as varying amounts of downtime and risk
You will need an Oracle database, a way to convert the definitions of the tables from SQL Server datatypes to Oracle datatypes, a way to move the data over to the new system, and a way to convert the stored procedures and packages Depending on how big and complex the database is, this
could be a very simple or a very complicated move
Not all of the datatypes can translate exactly from one platform to
another Table 1-3 shows just an example of some of the conversions
Moving the data is probably the least of your concerns, unless you have several terabytes of data to transfer Data can be moved out of SQL Server with the bcp utility, and then SQL*Loader can load it on the Oracle side SQL Server Integration Services (SSIS) packages can be created to export
from one database into the other
DBA Monitoring Checklist
DBAs typically monitor the following:
■ Backup jobs ran successfully (full and logs)
■ Space on server and tablespaces/data files
■ Errors in the alert log/server log
■ Any new information in the alert log/server log
■ Security auditing
■ Scheduled jobs ran successfully
■ Current statistics
Trang 9The Oracle SQL Developer tool is available to assist with any of these types of migrations, as shown in Figure 1-2 The Migration Wizard sets up a repository for the work area of the conversion process It pulls in the source information, translates the structures to Oracle structures, and then allows for movement of data online or offline, depending on how much data needs
to be transferred The constraints, primary keys, foreign keys, and check constraints are included in the migration process, and stored procedures are translated into Oracle structures If there are issues in converting a datatype, you will get an error when attempting the migration process (Oracle SQL Developer is discussed in more detail in Chapter 5.)
NOTE
Oracle SQL Developer can be used to manage
SQL Server databases Java Database
Connectivity (JDBC) drivers will need to be
configured with Oracle SQL Developer before
the SQL Server tab is present to connect to the
SQL Server database Details on the procedure
are available from the Oracle SQL Developer
Help menu Search for “database: third-party
JDBC drivers.”
Well, pulling the SQL Server database over into an Oracle database with the provided tools sounds simple enough Then the fun begins Just because
DATETIME DATE, TIMESTAMP
FLOAT NUMBER
VARCHAR VARCHAR2
VARBINARY BLOB
NUMERIC NUMBER
TABLE 1-3. Example Datatype Conversions
Trang 10the SQL Server database is now available in Oracle doesn’t mean that all of the indexes, statistics, and types of stored procedures are the best for use in Oracle and will perform optimally Testing and more testing are needed to validate that the new structures and datatypes match those in the stored
procedures, tables, and views
Validation of the data should include looking at the timestamps and
verifying that times as well as dates match up as needed Indexes and
referential integrity need to be verified The stored procedures need to be
checked to ensure they can return expected results Jobs will need to be
scheduled using DBMS_SCHEDULER Permissions need to be examined to confirm that the security configured for access by the users is present
As these pieces get validated for the application, you can look at the
areas that would benefit from different standards or from using some new
features in Oracle You can see how you did it in SQL Server and consider the best way to do it in Oracle The rest of this book will help guide you
along that path
FIGURE 1-2. Migration Wizard in Oracle SQL Developer