Friday, August 12, 2011

Archivelog on RAC

So good I posted it again.
http://www.toadworld.com/Newsletter/TWPIPELINESept2008/PIPESept08Oracle/tabid/450/Default.aspx

Enabling Archive Logs in a RAC Environment - (Oracle11g)
by Jeff Hunter 

Whether a single instance or clustered database, Oracle tracks (logs) all changes to database blocks in online redolog files. In an Oracle RAC environment, each instance will have its own set of online redolog files known as a thread. Each Oracle instance will use its set (group) of online redologs in a circular manner. Once an online redolog fills, Oracle moves to the next one. If the database is in "Archive Log Mode", Oracle will make a copy of the online redo log before it gets reused. A thread must contain at least two online redologs (or online redolog groups). The same holds true for a single instance configuration. The single instance must contain at least two online redologs (or online redolog groups).

The size of an online redolog file is completely independent of another intances' redolog size. Although in most configurations the size is the same, it may be different depending on the workload and backup / recovery considerations for each node. It is also worth mentioning that each instance has exclusive write access to its own online redolog files. In a correctly configured RAC environment, however, each instance can read another instance's current online redolog file to perform instance recovery if that instance was terminated abnormally. It is therefore a requirement that online redo logs be located on a shared storage device (just like the database files).

As already mentioned, Oracle writes to its online redolog files in a circular manner. When the current online redolog fills, Oracle will switch to the next one. To facilitate media recovery, Oracle allows the DBA to put the database into "Archive Log Mode" which makes a copy of the online redolog after it fills (and before it gets reused). This is a process known as archiving.

The Database Creation Assistant (DBCA) allows users to configure a new database to be in archive log mode, however most DBA's opt to bypass this option. In cases like this where the database is in no archive log mode, it is a simple task to put the database into archive log mode. Note however that this will require a short database outage. From one of the nodes in the Oracle RAC 11g configuration, use the following tasks to put a RAC enabled database into archive log mode. For the purpose of this article, I will use the node linux1 which runs the orcl1 instance:

  1. Login to one of the nodes (i.e. linux1) and disable the cluster instance parameter by setting cluster_database to FALSE from the current instance:

    $ sqlplus "/ as sysdba"
    SQL> alter system set cluster_database=false scope=spfile sid='orcl1'
    ;
  2. Shutdown all instances accessing the clustered database: 

    $ srvctl stop database -d orcl
  3. Using the local instance, MOUNT the database: 

    $ sqlplus "/ as sysdba"
    SQL> startup mount
  4. Enable archiving: 

    SQL> alter database archivelog;
  5. Re-enable support for clustering by modifying the instance parameter cluster_database to TRUE from the current instance: 

    SQL> alter system set cluster_database=true scope=spfile sid='orcl1';
  6. Shutdown the local instance: 

    SQL> shutdown immediate 
  7. Bring all instance back up using srvctl: 

    $ srvctl start database -d orcl 
  8. (Optional) Bring any services (i.e. TAF) back up using srvctl: 

    $ srvctl start service -d orcl 
  9. Login to the local instance and verify Archive Log Mode is enabled: 

    $ sqlplus "/ as sysdba"
    SQL> archive log list
    Database log mode              Archive Mode
    Automatic archival             Enabled
    Archive destination            USE_DB_RECOVERY_FILE_DEST
    Oldest online log sequence     83
    Next log sequence to archive   84
    Current log sequence           84

After enabling Archive Log Mode, each instance in the RAC configuration can automatically archive redologs!


Jeffrey Hunter graduated from Stanislaus State University in Turlock, California, with a Bachelor's degree in Computer Science. Jeff is an Oracle Certified Professional, Java Development Certified Professional, Author, and currently works as a Senior Database Administrator for The DBA Zone, Inc. His work includes advanced performance tuning, Java programming, capacity planning, database security, and physical / logical database design in a UNIX, Linux, and Windows NT environment. Jeff's other interests include mathematical encryption theory, programming language processors (compilers and interpreters) in Java and C, LDAP, writing web-based database administration tools, and of course Linux. Jeff has been a Sr. Database Administrator and Software Engineer for over 14 years and maintains his own website site at: http://www.iDevelopment.info.

Wednesday, July 20, 2011

Obama on the Debt Limit

The fact that we are here today to debate raising America’s debt limit is a sign of leadership failure. It is a sign that the U.S. Government can’t pay its own bills. It is a sign that we now depend on ongoing financial assistance from fore...ign countries to finance our Government’s reckless fiscal policies.

Over the past 5 years, our federal debt has increased by $3.5 trillion to $8.6 trillion. That is “trillion” with a “T.” That is money that we have borrowed from the Social Security trust fund, borrowed from China and Japan, borrowed from American taxpayers. And over the next 5 years, between now and 2011, the President’s budget will increase the debt by almost another $3.5 trillion.

Numbers that large are sometimes hard to understand. Some people may wonder why they matter. Here is why: This year, the Federal Government will spend $220 billion on interest. That is more money to pay interest on our national debt than we’ll spend on Medicaid and the State Children’s Health Insurance Program. That is more money to pay interest on our debt this year than we will spend on education, homeland security, transportation, and veterans benefits combined. It is more money in one year than we are likely to spend to rebuild the devastated gulf coast in a way that honors the best of America.

And the cost of our debt is one of the fastest growing expenses in the Federal budget. This rising debt is a hidden domestic enemy, robbing our cities and States of critical investments in infrastructure like bridges, ports, and levees; robbing our families and our children of critical investments in education and health care reform; robbing our seniors of the retirement and health security they have counted on.

Every dollar we pay in interest is a dollar that is not going to investment in America’s priorities.

This speech was made on the senate floor in 2006 and I completely agree. I wish other politicians, even the one who gave this speech, agreed with it too.

I think Obama even voted against raising the debt limit when he had to vote on it. Of course, there was a republican in the White House at the time. Washington was right. Political Parties will destroy this nation.

Thursday, March 17, 2011

Using Oracle for gridview functions.

I use ODP.NET for my oracle access and I've had problems using it in my Visual Studio projects, and using the built in functions with the gridview object.

1. Create a connection in the server explorer using ODP.NET for the connection.

2. In the gridview, use that connection to connect to the database. Your table must have a primary key in order for the editing functions to kick in. The primary key must be listed in the gridview.

3. You can have the steps build the update, delete sqls. You need to edit them in the source view. You need to keep the """ in the source. You cannot substitute double quotes for the "&quote;". Replace the ? of the generated strings with ":CAPPEDNAME". That is how MS tools like to pass the data and it uses the internals of oracle. That should be it.