Thursday, 1 September 2016

Undergrad done - Beacon Vlei 2016

I completed my undergraduate in management information systems (BSc Informatics) in May.
I received my results and passed my degree with distinction. Yay me. I have been studying part time for ~8 years and disappeared for a weekend to celebrate.

The farmhouses at Beacon Vlei are beautiful, looked after, and on the shore of a dam.
The website for Beacon Vlei can be found here

Images below








APEX Builder Installation error : ORA-00054: resource busy

While installing APEX builder in a duplicated database, I receive the following warnings and errors;

.  ____   ____           ____        ____
. /    \ |    \   /\    /     |     /
.|      ||    /  /  \  |      |    |
.|      ||---    ----  |      |    |-- 
.|      ||   \  /    \ |      |    |
. \____/ |    \/      \ \____ |____ \____
.
. Application Express Installation (DEV).
.........................................
.
... Checking prerequisites (ADD_DEV)
.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
.
... Prerequisite checks passed.
.
no rows selected
PL/SQL procedure successfully completed.
..................
..................
Installing SYS view wrappers
Create apex_sys_all_synonyms view

View created.

Create apex_sys_all_objects view

View created.

Create apex_sys_all_constraints view

View created.

Create apex_sys_all_dependencies view

View created.

Installing Team Development objects
...create team development objects
create table wwv_flow_news
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired 

create unique index wwv_flow_news_idx1 on wwv_flow_news(security_group_id, id)
                                         *
ERROR at line 1:
ORA-00942: table or view does not exist 

create table  wwv_flow_links (
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired 

create index wwv_flow_links_idx1 on wwv_flow_links (security_group_id)
                                    *
ERROR at line 1:
ORA-00942: table or view does not exist 

The installation continues, however, the side effects of the above missing objects are numerous.
Once the pages are loaded and the installer puts me back in the console, I notice a number of invalid objects in the apex schema.

It seems that during the Team Development object installation, a resource busy issue compromises the installation. The solution was not an entire re-installation but rather
a re-running of the problematic subset of the installer - manually - and chasing it up with a recompile.

The script that runs the Team development install is <APEX_SOURCE>\apex\devins.sql

Within the devins.sql script, I extract the following lines of script and rerun them manually as sysdba:

alter session set current_schema = APEX_040200;

prompt Installing Team Development objects
@./core/team_tab.sql
@./core/wwv_flow_team.sql
@./core/wwv_flow_team_api.sql
@./core/wwv_flow_team_gen_api.sql

I then run a recompile:
@?/rdbms/admin/utlrp

The APEX objects are valid again and the builder is accessible.


Thursday, 18 August 2016

Oracle 12C Developer VM and TWO_TASK

I managed to get my hands on an Oracle 12C developer image along with Oracle Virtual Box which can be downloaded from here...


It's come a long way since the last time I played with Oracle Virtual Box and I am impressed at how simple the setup is currently.

"You know sonny, back in my day, we had to create the VM image from scratch, install the OS, the software, setup the network, prepare the virtual drives and partition space ourselves! Easily a day or two of work!"
.

Not any more - all I had to do was grab the Oracle 12C .OVA file, load it into Oracle Virtual Box and within 20 minutes I had a polished and running copy of Linux, a copy of Oracle 12C EE and both a CDB and PDB. Lovely.

The best part was that I was able to setup Port Forward via settings panel which meant I can use my SSH client tools from my host. I forward port 22 from host to VM as shown below:



I can now connect to the VM using MobaXterm and work as a client.


It's also been a very long time since I've worked in Linux, I have missed it. I'll be using this new setup to explore the new features of 12C. So long in fact that I forgot all about TWO_TASK and what happens when it is not unset and not unset in .profile :

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Aug 18 13:17:10 2016

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

ERROR:
ORA-01017: invalid username/password; logon denied

[oracle@localhost ~]$ unset TWO_TASK
[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Aug 18 13:17:23 2016

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>
If I don't unset TWO_TASK, then it will take precedence over ORACLE_SID when trying to connect using '/ as sysdba'.

Friday, 12 August 2016

Another Crash

The same system impacted in April from a lost SAN went down again yesterday. The VM file vanished after the operators performed a routine system restart. We believe something else occurred and the operators did more than a routine reboot. As frustrating as the news was, the server admins rebuilt the OS and I restored Oracle - the system was up and open for business in 4 hours when the call was made to recreate the environment. The db was restored to the point of failure too. I am in the process of restoring the final integration components today.

I used the same notes I put down in the page: Database Fever

Monday, 8 August 2016

DR CRS Fails to Start - ACL entry creation failed for: owner

Upon reviewing the weekend scheduler sent emails for the system, I discovered the following output for our DR standby email:

DRDB DATABASE
=============
SP2-0640: Not connected

The correct output should show the number of hours our DR is trailing the production system. Clearly something was wrong.
I investigate the cluster log E:\OracleGrid\11.2.0.3\log\<NODE_1>\alert<NODE_1>.log:
2016-08-07 00:15:10.005: 
[ohasd(2040)]CRS-2112:The OLR service started on node <NODE_1>.
2016-08-07 00:15:10.425: 
[ohasd(2040)]CRS-1301:Oracle High Availability Service started on node <NODE_1>.

It began producing these messages again and again from Sunday morning until Monday morning. Something had occurred at midnight which the cluster-ware did not like.

I looked at the services.msc panel and found the OracleOHService to be down. I manually started it up and watched the log. It produced the aforementioned message again and the server went but to a shutdown state. OHAS was not starting and showed no errors in either log thus far. I then went into the OHASD log folder to see what I could see.

I found a series of 100M dump files output by the failed process as well as the stack dumps.
The dump read:
Symbol file E:\OracleGrid\11.2.0.3\bin\orannzsbb11.SYM does not match binary.

This did not look good I thought, I've seen this issue in the past and it had to do with a failed opatch. I had not opatched anything in DR before.
I looked through E:\OracleGrid\11.2.0.3\log\<NODE_1>\ohasd\ohasdOUT.log and found:

08/08/16 08:42:03  ssmain_run_crs:  CRS starting with restart argument
08/08/16 08:42:03  ssmain_stateCallback:  marking daemon service as active
08/08/16 08:42:03  ssmain_monitor_thread setting the service status to Running
08/08/16 08:42:03  **** caught exception (0xe06d7363) in thread 2756 ****
Oracle Database 11g OHAS Release 11.2.0.3.0 Production Copyright 1996, 2009, Oracle.  All rights reserved.
Main:  Parameters
  WaitForAutoStart:     1
  ServiceStartupDelay:  0
  MaxAutoStartDelay:    600000
OhasdQueryServiceInfo:  failed to get service handle for NisDrv, err(5)
OhasdReadService:  failed getting information for NisDrv, skipping
OhasdQueryServiceInfo:  failed to get service handle for NisSrv, err(5)
OhasdReadService:  failed getting information for NisSrv, skipping
OhasdReadService:  skipping service Oracle ACFS
OhasdReadService:  skipping service Oracle ADVM
OhasdReadService:  skipping service Oracle OKS
OhasdReadService:  skipping service OracleASMService+ASM
OhasdReadService:  skipping service OracleOraCrs11g_home1TNSListener
OhasdReadService:  skipping service OracleOraDb11g_home1ClrAgent
OhasdReadService:  skipping service OracleService<SID>
Main:  service list contains 0
Main:  completed waiting for 0 startup delay
Main:  completed all work, exiting

The drives we not starting. This really cannot be good I thought. I read the ohasd.log file and found:
E:\OracleGrid\11.2.0.3\log\<NODE_1>\ohasd\ohasd.log
2016-08-08 08:42:03.150: [ default][6944] OHASD Daemon Starting. Command string :restart
2016-08-08 08:42:03.150: [ default][6944] Initializing OLR

.........................
2016-08-08 08:42:03.275: [   CRSPE][2756] {0:0:2} Sent request to write event sequence number 5500000 to repository
2016-08-08 08:42:03.290: [   CRSPE][2756] {0:0:2} Wrote new event sequence to repository
2016-08-08 08:42:03.306: [   CRSPE][2756] {0:0:2} Reading (7) resources
2016-08-08 08:42:03.306: [   CRSPE][2756] {0:0:2} Reading (1) server pools
2016-08-08 08:42:03.306: [   CRSPE][2756] {0:0:2} Reading (13) types
2016-08-08 08:42:03.853: [   CRSPE][2756] {0:0:2} Finished reading configuration. Parsing...
2016-08-08 08:42:03.853: [   CRSPE][2756] {0:0:2} Parsing resource types...
2016-08-08 08:42:03.868: [  CRSSEC][2756] {0:0:2} Exception: OwnerEntry construction failed to retrieve user id by name with ACL string: owner:<DOMAIN>\<OLD_USER>:rwx and error: 1
2016-08-08 08:42:03.868: [  CRSSEC][2756] {0:0:2} Exception: ACL entry creation failed for: owner:<DOMAIN>\<OLD_USER>:rwx

For a very strange reason, the clusterware wanted to validate the owner of each resource, however, the user it was set to was the previous DBA. This is strange considering we only ever use a global administration account across all machines for all Oracle administration purposes. I struggled to think of what file or process may want to use the old credentials. I then executed:

ocrdump -local -stdout

This revealed the problem in detail

[CRS]
UNDEF : 
SECURITY : {USER_PERMISSION : PROCR_ALL_ACCESS, GROUP_PERMISSION : PROCR_READ, OTHER_PERMISSION : PROCR_READ, USER_NAME : <DOMAIN>\<OLD_USER>, GROUP_NAME : }

The CRS component along with all the components in the OCR, were registered to the old account. So, if the account was gone, it would explain why the CRS was not coming up.
I searched for the user in active directory via a PROPERTIES>SECURITY>ADVANCED>OWNER>EDIT to see if the user existed. It did not. I could find my user, but not this one.

I then requested that the network administrator contact the domain administrator to reinstate the user. It turned out that the user was deleted over a year ago but the DR server had not been restarted since. Reinstating the account it resolved the issue and cluster started up correctly.

Note 1491367.1 has details on how to handle the issue. However, removing components was not applicable in this situation owing to the fact that the vast majority of components were all owned by this single user. I will look for a way to change the owner of components in time.

Monday, 25 July 2016

Authentication - Oracle Service Terminated Unexpectedly

This morning, a public facing portal database was not starting up after a restart. I could not login the database as sysdba to startup owing to

ORA-12560: TNS:protocol adapter error.

Looking at the services, the OracleService<SID> was down.
When starting the OracleService<SID>, I received an unexpected "Oracle service terminated unexpectedly" prompt.
When investigating the alert log, I see the database begins starting up but ends with

ORACLE_BASE from environment = E:\Oracle

The next step in the startup would be

alter database mount exclusive

- but it does not get this far.

I check the listener file at E:\Oracle\diag\tnslsnr\<HOST>\listener_<SID>\trace\listener_<SID>.log
and found
TNS-12518: TNS:listener could not hand off client connection
 TNS-12560: TNS:protocol adapter error
  TNS-00530: Protocol adapter error
   64-bit Windows Error: 203: Unknown error

I also checked the E:\Oracle\diag\clients\user_<USER>\host_2051522117_80\trace\sqlnet.log file for the SYSTEM user
 
***********************************************************************

Fatal NI connect error 12637, connecting to:
 (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle)(ARGV0=oracle<SID>)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))')))(CONNECT_DATA=(SID=<SID>)(CID=(PROGRAM=E:\Oracle\product\11.2.0\dbhome_1\bin\oradim.exe)(HOST=<SERVER>)(USER=SYSTEM))))

  VERSION INFORMATION:
TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
Oracle Bequeath NT Protocol Adapter for 64-bit Windows: Version 11.2.0.3.0 - Production
  Time: 25-JUL-2016 09:18:42
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12637
    
TNS-12637: Packet receive failed
    ns secondary err code: 12532
    nt main err code: 0
    nt secondary err code: 0
    nt OS err code: 0

The issue is related to connectivity or authentication.
I checked ora_dba privileges and found that the group had the correct users within.
I checked the user starting the OracleService<SID> service and it was the Local System users.

I suspected domain authentication issues and so I changed the SQLNET.ORA parameter

SQLNET.AUTHENTICATION_SERVICES = (NTS)

to

SQLNET.AUTHENTICATION_SERVICES = (NONE)

This worked and the database was able to startup using the service.
However, I could no longer execute backups or use sysdba but at least the database was up for now.

After much digging and investigating, it turned out the issue was that one service was not started upon the recent restart of the server machine. That service is the workstation service. This service allows a machine on the Microsoft domain to access files on remote machines. I guesstimate that the remote call aims to authenticate the user starting the service but fails to receive a valid response if this service is down.

Upon starting the service up, the database was taken out of NONE authentication and put back into NTS. The backups are running successfully and I am able to connect again as SYSDBA.



Monday, 18 July 2016

Database in the Jungle

Lagoon of Cotonou by Mark Fischer 
I am being sent to West Africa to configure and possibly reinstall database and middleware servers. It will be an interesting experience and I will likely post images and anecdotes from the week I spend in the coastal city of Cotonou in Benin.

The trip came about for a number of reasons, but the definitive one, from my understanding, is that the engineers initially selected for the project do not want to go for sudden reasons. So, my colleague and I will be shipped off to drive the project and setup the foundations for a new information system. It doesn't help that we don't speak french but we'll deal with what ever comes our way.

In preparation, I've had to receive vaccinations for various bugs including yellow fever. I was even given a little yellow book to say that I am yellow fever proof. I've also been given 2 weeks supply of malaria tablets. Until we fly, I will be preparing my scripts, software installations, patches and certificates so that I am prepared and self reliant during my week long stay. We're not sure what to expect of internet accessibility but considering it is a large organisation, we have faith that basic internet connectivity will be available in the event we need access to the outside world.