Oracle Database Administration for Microsoft SQL Server DBAs part 33 pps

10 366 0
Oracle Database Administration for Microsoft SQL Server DBAs part 33 pps

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

Thông tin tài liệu

Deleting here might be useful for backups, but definitely not something you would want to do with database files. These are the options that are available with the ASMCMD utility. Viewing ASM Information When connected to the ASM instance, some v$ views give information about the instances connected, disks that might not be part of a disk group, and files. For example, the v$asm_disk view shows the disks that are being used by that database instance, and when viewed from the ASM instance, it will show all of the disks that are discovered. Table 10-2 lists some of the ASM v$ views. 302 Oracle Database Administration for Microsoft SQL Server DBAs View Logged in to ASM Instance Logged in to Database Instance v$asm_client Shows a row for each database instance using ASM Shows a row for the ASM instance for the database v$asm_disk Shows all of the disks that are discovered Shows only the disks in the disk groups being used by this instance v$asm_diskgroup Shows all of the disk groups that are discovered Shows the disk groups that are available in the ASM v$asm_file Shows the files for each disk group mounted Shows the files for the instance v$asm_operation Shows the file for each long-running operation executing in the ASM instance Shows no rows TABLE 10-2. Some ASM v$ Views Here are some examples of using SQL*Plus to take a look at the views in ASM, making sure the environment is set up to log in: >export ORACLE_SID= +ASM >export ORACLE_HOME=/u01/oracle/11.2.0/grid SQLPLUS> select name, state, total_mb from v$asm_disgroup; NAME STATE TOTAL_MB DG_DATA01 MOUNTED 349962 DG_DATA02 MOUNTED 349942 SQLPLUS> select name from v$asm_disk; NAME ORADATA01 ORADATA02 ORADATA03 ORADATA04 SQLPLUS> select instance_name, db_name, status from v$ASM_CLIENT; SQL> select group_number, instance_name, db_name, status from v$ASM_CLIENT; GROUP_NUMBER INSTANCE_NAME DB_NAME STATUS 1 DBDEV DBDEV CONNECTED 2 DB01 DB01 CONNECTED 1 +ASM +ASM CONNECTED 2 +ASM +ASM CONNECTED 4 rows selected. >export ORACLE_SID=DB01 >export ORACLE_HOME=/u01/oracle/11.2.0/database SQLPLUS> select group_number, instance_name, status from v$asm_client; GROUP_NUMBER INSTANCE_NAME DB_NAME STATUS 1 +ASM DB01 CONNECTED Notice the difference between the view results on the ASM instance and the database instance. Also, if there are no disks available in v$asm_disk, this might indicate an issue with the parameter ASM_DISKSTRING or even permissions on the directories or devices. Chapter 10: High-Availability Architecture 303 Streams and Advanced Replication Replication provides copies of data to different servers, and it can be used to move data. While it isn’t a failover mechanism usually associated with high availability, it does help ensure that data is available and can provide a way to selectively pull out the important data. SQL Server has replication to distribute transactions to a subscriber. You create the publisher, which can be various tables, and then you can make subscriptions to the publisher for replicating to another server. The SQL Server publisher, distributor, and subscriber fill the roles of capture, stage, and consume or apply. Some setup with a replication administration user and another database is required. For replication, Oracle offers Oracle Streams and the Advanced Replication option. Which one you use depends on your replication requirements, including what needs to be replicated in your environment. Oracle Streams Oracle Streams, included as part of the Oracle database installation, captures data changes to distribute to another database. The phases of Streams are similar to the SQL Server publisher, distributor, and subscriber roles. A user needs to be created to manage the replication, and a tablespace is also required. Setting Up Oracle Streams The Streams administrator user needs the DBA permissions and admin privilege on the DBMS_STREAMS_AUTH package. Here is an example for granting the permissions to the user: SQLPLUS> grant CONNECT, RESOURCE, DBA to streamadmin; SQLPLUS> begin DBMS_STREAMS_AUTH.GRANT_ADMIN_ PRIVILEGE( grantee => 'streamadmin', grant_privileges => true); END; / SQLPLUS> grant SELECT_CATALOG_ROLE to streamadmin; SQLPLUS> grant SELECT ANY DICTIONARY to streamadmin; The parameter configurations for Streams setup are GLOBAL_NAMES= TRUE, JOB_QUEUE_PROCESS higher than 2, and STREAMS_POOL_SIZE at least 200MB. A database link is used to connect to the target server, so the databases do not need to be identical. 304 Oracle Database Administration for Microsoft SQL Server DBAs Changes for data and objects are captured and replicated. Replication can be configured for the whole database, schemas, tables, or even tablespaces. You can set up Streams through OEM, as shown in Figure 10-9, or through the DBMS packages. Through OEM, you can also choose to set up downstream capture and create an advanced queue. Downstream capture collects streams on a remote database other than the source. The archive logs can be shipped to where the downstream capture is configured, or the downstream can be a real-time data capture. The queue is a messaging system that queues up information to pass it along for other applications or databases to use to have persistent messages. This is used for distributed applications to communicate and coordinate processes in an asynchronous manner. Having the flexibility to implement Streams for just a schema instead of the whole database allows you to choose which pieces are more highly available. The replication doesn’t failover the application to a copy of schema, but provides a place to get the data, at least via a manual connection. The DBMS_ STREAMS_ADM package has procedures for adding schema and table rules, and setting up the queue table. Chapter 10: High-Availability Architecture 305 FIGURE 10-9. Setting up Oracle Streams in OEM Using Oracle Streams Oracle Streams uses logical change records (LCRs) for each row of a table modified. Each LCR has the name of the table changed, old and new values for any changed columns, and values for the key columns. This information can be applied to the rows at the destination sites and resolve conflicts if they arise. The changes are captured and staged based on the rules of what is to be replicated. For the capture side, log-based capture pulls the changes out of the redo logs. Capturing the information from the redo logs minimizes the overhead on the system and any of the table changes. The tables that are marked for replication need to log supplemental information in the redo logs, such as the primary key columns. The log-based capture has a reader service that reads the redo logs, and then prepares servers to scan the defined regions from the reader. The filter of the LCRs is based on the rules and definitions set up to replicate, so only the changes that are needed are captured. The builder server merges the records from the preparer and then passes the change to the staging area for processing. Capturing the changes from the redo logs can come from the log buffer, active redo, and the archive log files. Another capture type is synchronous, which captures the changes as they are happening. This can be used for tables that might be updated often and are a smaller subset of tables. It captures the DML changes for each row and converts it to an LCR. The capture of this change is then passed along to the staging area. Using rules for publishing and subscribing to the staging area offers flexibility in the routing of the streams. The staging area with the queues will even allow the information to be passed to a database that might not have a network connection to the main database, by passing through another database that has connections to both. The consumption of the information is done by the apply engine. The apply engine detects conflicts and applies automatically captured DML and DDL changes. Here again, you have the flexibility of using declarative transformations or user-supplied functions to set up each LCR. The source database is kept throughout the Oracle Streams processing. The administrator controls which changes are to be captured. The apply engine can be customized with PL/SQL procedures and functions, which 306 Oracle Database Administration for Microsoft SQL Server DBAs can be registered with the Streams administrator. An example for this is to apply all of the changes except the deletions on a specific table. Streams has an advisor that will help with performance and monitoring of the throughput and latency. The advisor looks at each of the areas in the process: capture, stage, and apply. Advanced Replication Along with Oracle Streams replication, Oracle offers an Advanced Replication option. This handles master replication with a single master or multiple masters. Multimaster replication is known as peer-to-peer , and any of the servers can be updated. Advanced Replication processing to multiple masters can be asynchronous and synchronous. For this type of replication, you need to set up a replication admin user. Tables in the databases should have primary keys. The DBMS_REPCAT package provides routines for administering and updating the replication catalog. Advanced Replication offers the option of replicating to non-Oracle databases. This allows a way to provide data to several different systems. Also, with this type of replication, the Oracle database version and platform do not need to be the same for replication. Advanced Replication may be suitable for distributed or data warehouse databases, to have copies available for other systems or to maintain the workload on different servers. Summary The role of the DBA is to provide a reliable database environment. Businesses are requiring that systems be up and available 24/7. The DBA needs to understand the options for the database system to provide high availability. This includes knowing the resource costs for each solution and what type of availability it provides. Making a case for how a high-availability solution improves the management and reliability of the database, as well as provides for the needs of the business, is the responsibility of the DBA. Implementing, deploying, and administering the environment is the fun part for the DBA. Chapter 10: High-Availability Architecture 307 SQL Server has high-availability solutions that you might have considered and/or implemented. The options for SQL Server do not behave the same as those for Oracle. Even though both have clustering, there are significant differences. Looking at the differences is a good place to start to understand the Oracle solutions. However, you also should examine the specific features and possible configurations of Oracle RAC, Data Guard, and other high- availability options. Look into the Maximum Availability Architecture for Oracle, which combines solutions to handle different requirements and reduce the risks for failures. 308 Oracle Database Administration for Microsoft SQL Server DBAs appendix Mental Preparedness for Multiple Platforms M y native language is English, but for some crazy reason, I wanted to learn German in high school. I learned about the language, discovered new words, and learned how to speak a couple of phrases. I started to learn about the syntax and gender of words. I was able to understand a very basic conversation, and I could read a simple article. My translations were straight word for word; I did not understand the slang. At the university, I was exposed to more German. I studied the grammar and learned more about the culture, which helped me in understanding different meanings of phrases instead of just translating each word into English. Then I lived in Germany for several years, immersed in the language. I started to be able to speak the phrases and dialect. I even began to dream in German, and I realized I finally had made the German language a part of who I am. Some of you might have experienced similar situations with learning a new language. We also experience this with computer languages and database platforms. We have spent this book going through typical tasks and syntax of how to do things in Oracle, even though SQL Server is your native language. We used this as a baseline to understand the concepts of the database environment and tasks that need to be done. The translations were done into Oracle— some more direct than others. For example, the terms database and instance were matched up with each other. The database/instance comparison was to illustrate the Oracle environment—its objects and behaviors—and to truly convey what Oracle DBAs mean when they say “database.” Mental preparedness for multiple platforms is being able to distinguish between the different platforms. It is being able to speak the language of one platform one minute, and switch over to the language of another platform in the next minute. You start by learning enough of the differences to make the transition easier, but then begin to learn about the platform in more depth. It is still possible to translate between the different platforms, but in doing so, you might miss the real meaning or underlying concept. Take that extra step to try to “dream in Oracle.” Try to stop comparing it with SQL Server, and start embracing some of the Oracle features for what they are. This is definitely not an easy task. It might take a few years for you to be able to bounce between platforms without thinking about it. A good place to start is with some checklists for each platform to help smooth the transition. 310 Oracle Database Administration for Microsoft SQL Server DBAs Each of the platforms has a different starting point for troubleshooting a problem. Start a checklist for troubleshooting the problems based on each platform. It will increase the experience you have with the different database environments when looking at the issues from different perspectives. How do you go about looking at connection issues? What about performance? How about permissions and statistics? Consider where all of these types of issues fall as database administration activities—daily versus weekly, automatic versus manual, cause of an issue versus fix for an issue, and so on. Resolving a performance issue in SQL Server might start with looking for locks and long-running queries, which could lead to needing to rebuild indexes. In the Oracle environment, the search might start with looking at session waits and checking if there are table scans because of stale statistics. These starting points are good to have for each environment to be able to jump into a different platform quickly. In not thinking about which platform, quite a few times I have gone down a path in SQL Server to research a performance issue by looking at statistics and indexes instead of looking at sp_who2 for blocking issues. In SQL Server, blocking issues might be higher on my list of things to check, but I might have skipped a quick check because I didn’t think of the environment and may have even started to work on tuning the queries. On the other hand, even though that might not have been the solution, tuning queries is always worth it for better performance no matter what database environment. At some point, the troubleshooting may look the same or converge, depending on the issue, but understanding how the system behaves and what some of the main issues can be is a good place to start. Of course, some of the DBA tasks in the environments are the same. For example, backups are important in any database system, but what is backed up and the options are different. That could even be said for different databases in the same platform. Not only are you translating to a different database platform, but you also must use different applications, which, as a DBA, you should be used to by now. For maintenance jobs and tasks, be sure to look at the version of the database, the platform, and any new features that might make the task easier or even obsolete. Oracle did this with tablespaces. It was very typical to coalesce and reorganize the tablespaces and tables, but with locally managed tablespaces, this became less of a worry. SQL Server might have a higher priority to rebuild cluster indexes, where Oracle might be looking at statistics on the tables and indexes for the optimizer to have the correct information. What is new in the database, the tasks, and maintenance should be reviewed Appendix: Mental Preparedness for Multiple Platforms 311 . and reduce the risks for failures. 308 Oracle Database Administration for Microsoft SQL Server DBAs appendix Mental Preparedness for Multiple Platforms M y native language is English, but for some crazy. identical. 304 Oracle Database Administration for Microsoft SQL Server DBAs Changes for data and objects are captured and replicated. Replication can be configured for the whole database, schemas,. ASM v$ views. 302 Oracle Database Administration for Microsoft SQL Server DBAs View Logged in to ASM Instance Logged in to Database Instance v$asm_client Shows a row for each database instance

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

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