Monday, January 03, 2011

solve oracle error ORA-01999: password file cannot be updated in SHARED mode

sometimes under specific conditions you want to change the password of the Oracle database user sys. Their is however something special with the password for the sys user which might cause you to run into a ORA-01999 error. reason for this is that your database is using a REMOTE_LOGIN_PASSWORDFILE file and this file is set to SHARED. Shared means that one or more database can share the same password file which is for example used in a RAC setup. In my case it was NOT a RAC setup it was a standalone database. So if you want to change the sys password in that case you have to change the mode from SHARED to EXCLUSIVE.

Accoording to the Oracle documentation you have the following options:

# NONE: Setting this parameter to NONE causes Oracle Database to behave as if the password file does not exist. That is, no privileged connections are allowed over nonsecure connections.

# EXCLUSIVE: (The default) An EXCLUSIVE password file can be used with only one instance of one database. Only an EXCLUSIVE file can be modified. Using an EXCLUSIVE password file enables you to add, modify, and delete users. It also enables you to change the SYS password with the ALTER USER command.

# SHARED: A SHARED password file can be used by multiple databases running on the same server, or multiple instances of a Real Application Clusters (RAC) database. A SHARED password file cannot be modified. This means that you cannot add users to a SHARED password file. Any attempt to do so or to change the password of SYS or other users with the SYSDBA or SYSOPER privileges generates an error. All users needing SYSDBA or SYSOPER system privileges must be added to the password file when REMOTE_LOGIN_PASSWORDFILE is set to EXCLUSIVE. After all users are added, you can change REMOTE_LOGIN_PASSWORDFILE to SHARED, and then share the file.

The below example illustrates the error:

SQL> passw sys
Changing password for sys
New password:
Retype new password:
ERROR:
ORA-01999: password file cannot be updated in SHARED mode

Now we have 2 options to do solve this depending on the fact if your database uses a spfile or a pfile setup.

When using a spfile you can do the following:

SQL> alter system set REMOTE_LOGIN_PASSWORDFILE = 'EXCLUSIVE' scope=spfile;

When using a pfile you will have to vi the content of your pfile.

After the settings are picked-up by the database you can change your sys password.

solve ORA-00845: MEMORY_TARGET not supported on this system

I recently tried to start an "old" Oracle 11G database which was installed on a system I used for some other projects. Due to the other projects some settings to the operating system have changed.

When the database was started during the system boot I found an error on the console stating the following error:

ORA-00845: MEMORY_TARGET not supported on this system

It turned out that my tmpfs filesystem was to small for the original settings of my Oracle database. tmpfs is a common name for a temporary file storage facility on many Unix-like operating systems. It is intended to appear as a mounted file system, but stored in volatile memory instead of a persistent storage device. A similar construction is a RAM disk, which appears as a virtual disk drive and hosts a disk file system.

You can check your tmpfs mount with a simple df -h command like below (this is the state after the change):

[oracle@oem bin]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda2 4.1G 3.0G 1.1G 75% /
/dev/xvda1 92M 12M 76M 14% /boot
tmpfs 3.0G 1.2G 1.8G 41% /dev/shm
/dev/xvdb1 27G 13G 13G 49% /u01
[oracle@oem bin]$

It turned out the size was not 3.0G and it turned out that my database settings where set for a 2.0G system. You can check this by executing the following command's"

SQL>
SQL> show parameter MEMORY_MAX_TARGET;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
memory_max_target big integer 2G
SQL> show PARAMETER MEMORY_TARGET;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
memory_target big integer 2G
SQL>
SQL>

This shows we need at least 2.0G, to be sure I made my tmpfs 3.0G by editing my /etc/fstab file. Originally it looked like the one below:

[oracle@oem bin]$ cat /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-VM swap swap defaults 0 0
LABEL=oms /u01 ext3 defaults 1 2
[oracle@oem bin]$

You can change it to the example below so you will mount 3.0G:

[oracle@oem bin]$ cat /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs size=3000m 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-VM swap swap defaults 0 0
LABEL=oms /u01 ext3 defaults 1 2
[oracle@oem bin]$

Saturday, January 01, 2011

Oracle VM import template

When using the Oracle VM server to virtualize operating systems you have the option to download templates from Oracle at this edelivery site; http://edelivery.oracle.com/oraclevm . When you download a template you will have to place in the seed_pool directory which can be used by the Oracle VM Manager to use this template to create new virtual machines based upon this template.

If you place the template in the seed_pool location and you check the virtual machine templates screen of your Oracle VM manager you will not see the new template directly. I have just uploaded the OVM_EM_111 template however it is not visible. You will have to activate it first in your VM manager.

On this screen you can click the import function. This will present you the below screen. Here you will have a couple of options. As we have placed the template in our seed_pool directory we will select the option "select from Server Pool (Discover and register)". This will look into the seed_pool and query for all templates which have not yet been activated in the Oracle VM Manager. Other options are "Download from External Source (HTTP and FTP). This can be used in case you store your templates on a HTTP or FTP server somewhere else in your network. An other option is the P2V import function which will do a Physical to Virtual Migration, aka, making a none virtualized system a virtualized system.

When we select the option "select from Server Pool (Discover and register)" we will have to provide some information about the new template and the pool. First we have to select the server pool in which we have placed the template, in our case this is TestPool. This will present a list of none activated templates in the seed_pool directory of this server pool. So we select i our case the OVM_EM_111 template.

We have to state the operating system, a default username and a password and optional we can add a description. After clicking next you can review the information and confirm the operation.

You will now be able to see the new virtual machine OVM_EM_111 in your overview, first the status will be "Importing", for the seed_pool option this is a very short operation, HTTP/FTP will take some more time and P2V can take quite some time depending on the size of the machine. When imported the status will change to "Pending". This means the import has succeeded however you will have to approve the use of this template. You can see the "Approve" button active on the top of the templates.

When clicking on the approve button you will see the below screen where you can add some details and when clicking on the "Approve" button. This will make your template imported and activated/approved for use in the Oracle VM Manager console.

Final result is that you will now see you template active in the total list of templates which can be used.