Oracle Database Administration for Microsoft SQL Server DBAs part 2 pptx

10 372 0
Oracle Database Administration for Microsoft SQL Server DBAs part 2 pptx

Đang tải... (xem toàn văn)

Thông tin tài liệu

3 Oracle Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Operating Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Windows Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Useful Linux/Unix Commands . . . . . . . . . . . . . . . . . . . . . . 48 Linux Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Storage Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Disk Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Storage Management with ASM . . . . . . . . . . . . . . . . . . . . . 57 Oracle Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Oracle Database Components . . . . . . . . . . . . . . . . . . . . . . 63 Oracle Software Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Using a Response File . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Removing Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Upgrading the Database . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Applying Patches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 4 Database Definitions and Setup . . . . . . . . . . . . . . . . . . . . . . . . . 73 Servers, Databases, Instances, and Schemas . . . . . . . . . . . . . . . . 74 SQL Server Setup Versus Oracle Setup . . . . . . . . . . . . . . . . . . . . 77 Creating Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Using the DBCA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Duplicating Databases with Templates and Scripts . . . . . . 83 Creating the Listener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Choosing a Character Set . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Permissions for the Server . . . . . . . . . . . . . . . . . . . . . . . . . 95 Permissions for Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . 98 DBA Roles and Responsibilities Revisited . . . . . . . . . . . . . 101 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 5 DBA Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Overview of Tools for Typical Database Tasks . . . . . . . . . . . . . . . 104 Oracle Enterprise Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 OEM Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Storage Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Database Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Oracle Scheduler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Statistics and Resource Management . . . . . . . . . . . . . . . . . 109 vi Oracle Database Administration for Microsoft SQL Server DBAs Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Enterprise Manager Configuration . . . . . . . . . . . . . . . . . . . 111 SQL*Plus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 SQL Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Client Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Client Connection Configuration . . . . . . . . . . . . . . . . . . . . 120 JDBC Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 My Oracle Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 6 Database Backup, Restore, and Recovery . . . . . . . . . . . . . . . . . . 127 Backing Up Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Backup Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Backup and Restore Commands . . . . . . . . . . . . . . . . . . . . 129 RMAN Configuration for Backups . . . . . . . . . . . . . . . . . . . 131 Backup Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Backup Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 OEM Backup Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 Restoring and Recovering Databases . . . . . . . . . . . . . . . . . . . . . . 141 What Can Go Wrong? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Restore and Recover Options . . . . . . . . . . . . . . . . . . . . . . . 143 Data Recovery Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Copying the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Managing Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Viewing Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Purging Obsolete Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Backing Up and Restoring Objects . . . . . . . . . . . . . . . . . . . . . . . 156 Copying Objects at the Table and Schema Level . . . . . . . 156 Using Data Pump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Protecting Users from Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Recycle Bin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Flashback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 7 Database Maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 Maintenance Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 Consistency Checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 Health Checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 Contents vii viii Oracle Database Administration for Microsoft SQL Server DBAs Update Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 System Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Object Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 Object Maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 Index Rebuild . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 Table Reorganization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Invalid Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Grants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Synonyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Job Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Creating a Job in Oracle Scheduler . . . . . . . . . . . . . . . . . . 191 Using DBMS_SCHEDULER . . . . . . . . . . . . . . . . . . . . . . . . 194 Setting Up System and User Jobs . . . . . . . . . . . . . . . . . . . . 196 File Maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 Shrinking and Resizing Files . . . . . . . . . . . . . . . . . . . . . . . 197 Tablespace Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 Error Logs, Alert Logs, and Trace Files . . . . . . . . . . . . . . . . 203 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 8 Performance and Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 Better-Performing Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Index Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Index Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Locking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Current Activity Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 Current Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 Activity Monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Waits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 SQL Plans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 Viewing Explain Plans . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 Tuning Using Explain Plans . . . . . . . . . . . . . . . . . . . . . . . . 228 Automatic Workload Repository . . . . . . . . . . . . . . . . . . . . . . . . . 233 AWR Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 Active Session History View . . . . . . . . . . . . . . . . . . . . . . . 236 Library Cache for SQL Statements . . . . . . . . . . . . . . . . . . . 236 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 9 PL/SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 Database Coding Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 Packages and Package Bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 Contents ix Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 Updates and Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Beginning a Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . 251 Defining Commits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 Cursor Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Processing with FORALL . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Debugging Procedures and Unit Testing . . . . . . . . . . . . . . . . . . . 262 Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Error Handling Packages . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Standard Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . 268 Using DBMS Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 10 High-Availability Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . 273 Options for High Availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 Clustering with RAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 Configuring RAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 Testing RAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 Setting Up Client Failover . . . . . . . . . . . . . . . . . . . . . . . . . 283 Setting Up RAC Listeners . . . . . . . . . . . . . . . . . . . . . . . . . . 285 Patching RAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Deploying RAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Configuring and Monitoring RAC Instances . . . . . . . . . . . . 287 Primary and Standby Databases . . . . . . . . . . . . . . . . . . . . . . . . . . 289 Using Active Standby Databases . . . . . . . . . . . . . . . . . . . . 290 Setting Up a Standby Database . . . . . . . . . . . . . . . . . . . . . 292 ASM in an RAC Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 Managing ASM Disk Groups . . . . . . . . . . . . . . . . . . . . . . . 297 Viewing ASM Information . . . . . . . . . . . . . . . . . . . . . . . . . 302 Streams and Advanced Replication . . . . . . . . . . . . . . . . . . . . . . . 304 Oracle Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 Advanced Replication . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 This page intentionally left blank Acknowledgments It is because I have been able to share this experience with my family, friends, and coworkers that I have felt such a sense of accomplishment in completing this book. I truly would like to thank all of them, and I am glad that they share in different aspects of my life. Thanks to my junior DBAs, Emily and Mandy, who have also heard what an Oracle SGA is as I have read some pages to them for bedtime stories. Thanks for listening to me even without understanding, and now we can get back to other bedtime stories. Thanks to my husband, Bernd, for his understanding as I pursue new challenges. Thanks to my technical editor, Kim Floss, for reviewing and making the book even better. Thanks to my sister, Carrie Steyer, for being available as a sounding board for some of my ideas. Thanks to the awesome DBA team at DRW, which I am proud to be a part of—Laura Culley, Randy Swanson, and Henry Treftz—and for their help in testing some of the examples contained in this book. Thanks to the IOUG Board of Directors, Ian Abramson, Judi Doolittle, Andy Flower, Kent Hinckley, Steve Lemme, John Matelski, Todd Sheetz, Jon Wolfe, and my mentors in the user group community, who have encouraged me to share my ideas and have provided me with opportunities to grow and develop in my career. xi This page intentionally left blank Introduction Database environments are constantly growing. There is definitely not a shortage of data, and many companies need their systems to be constantly up and available. For various reasons, companies may have different database platforms that they use for storing the data. This means that DBAs need the skills to support mixed environments. Oracle database solutions are a large part of a robust enterprise database environment. Oracle provides high-availability solutions, efficient ways to manage very large databases, and configurations for better performance. New features in Oracle Database 11 g have simplified some of the configurations and maintenance for the database. However, even with some of the areas being automated and easier to manage, there is still much to learn about Oracle and the different options and components of Oracle databases. Some database concepts, such as data modeling and database backup and recovery plans, carry across different platforms. Also, there are common tasks that DBAs perform to maintain any database environment. This book covers tasks in Oracle as they relate to the SQL Server ways of doing things, providing translations between the two platforms. It compares some of the standard practices and looks at how the internals of the database require some different maintenance and health checks. The point is not to say that one platform’s feature is better than the other’s, but to help you learn how to use and implement both similar features and different features. Each chapter includes comparison tables listing the SQL Server and Oracle commands or components related to the topic. This makes it easy for those who are familiar with how to do something in SQL Server to find the information they need for working with Oracle. xiii The book covers a broad range of topics related to administering databases, including the following: ■ The internals of Oracle and system information that is available to configure the database settings ■ Installations, including some basic Linux commands and details that are needed for the installation on Linux ■ Database creation and the different terminology and security associated with Oracle databases ■ The tools available to perform administrative tasks, such as Oracle Enterprise Manager and SQL Developer ■ Backup and restore planning and procedures ■ Management of statistics and database objects, and performance tuning ■ Use of PL/SQL, including how it varies from Transact-SQL ■ High-availability solutions for the architecture and design of the database system This book is designed to help DBAs leverage the skill set they’ve already developed on another database platform and advance that knowledge to the Oracle database systems. The goal is to ease your transition to Oracle and show you how to effectively administer the Oracle database system. xiv Oracle Database Administration for Microsoft SQL Server DBAs CHAPTER 1 The Database Administrator . and show you how to effectively administer the Oracle database system. xiv Oracle Database Administration for Microsoft SQL Server DBAs CHAPTER 1 The Database Administrator . . . . . . . . . . . . . . . . . . . . . . . . 174 Contents vii viii Oracle Database Administration for Microsoft SQL Server DBAs Update Statistics . . . . . . . . . . . . . . . . . . . . . . different database platforms that they use for storing the data. This means that DBAs need the skills to support mixed environments. Oracle database solutions are a large part of a robust enterprise database environment.

Ngày đăng: 04/07/2014, 05:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan