Thursday 28 June 2012

Solaris - ZFS snapshots

We had a need to be able to have a recovery plan for some Solaris servers involved in a application upgrade.

Investigations led to the following which would cover us from the / (root) upwards, but not cover mountpoints.

# zfs list

NAME                     USED  AVAIL  REFER  MOUNTPOINT
rpool                   37.0G  30.0G    97K  /rpool
rpool/ROOT              22.8G  30.0G    21K  legacy
rpool/ROOT/root_ds      22.8G  30.0G  21.6G  /
rpool/ROOT/root_ds/var  1.29G  30.0G  1.29G  /var
rpool/dump              1.00G  30.0G  1.00G  -
rpool/export            11.0G  30.0G  4.53G  /export
rpool/export/home       6.52G  30.0G  6.52G  /export/home
rpool/swap              2.06G  32.0G  9.94M  -
snapshot the filesystem:

# zfs snapshot rpool/ROOT/root_ds@thursday

NAME                          USED  AVAIL  REFER  MOUNTPOINT
rpool                        37.0G  30.0G    97K  /rpool
rpool/ROOT                   22.8G  30.0G    21K  legacy
rpool/ROOT/root_ds           22.8G  30.0G  21.6G  /
rpool/ROOT/root_ds@thursday  3.40M      -  21.6G  -
rpool/ROOT/root_ds/var       1.29G  30.0G  1.29G  /var
rpool/dump                   1.00G  30.0G  1.00G  -
rpool/export                 11.0G  30.0G  4.53G  /export
rpool/export/home            6.52G  30.0G  6.52G  /export/home
rpool/swap                   2.06G  32.0G  9.94M  -
To check files in the snapshot you can go to /.zfs/snapshot/<snapshot name> (which is a hidden file)

To rollback:

# zfs rollback rpool/ROOT/root_ds@thursday

To delete the snapshot:

# zfs destroy rpool/ROOT/root_ds@thursday

Tuesday 12 June 2012

Solaris - Oracle 11g install (Ephemeral Ports)

The DBAs were uprading from 10g to 11g - they found an issue where 11g complains about the TCP and UDP port settings. Some how this escaped the QA testing prior to Oracle releasing the version (I've been informed that Oracle weren't looking at fixing the issue at present - luckily we don't pay a vast amount of money for Oracle licensing..... Oh, wait. We do!!).

Error message:

11.2.0.2 Installer (OUI) requires anon_port parameters to be set [ID 1266293.1]

Temporary fix which applies to:

Oracle Server - Enterprise Edition - Version 11.2.0.2 and later
Oracle Solaris on SPARC (64-bit)
Oracle Solaris on x86-64 (64-bit)


Run the following:

# ndd -set /dev/udp udp_smallest_anon_port 9000
# ndd -set /dev/udp udp_largest_anon_port 65500
# ndd -set /dev/tcp tcp_smallest_anon_port 9000
# ndd -set /dev/tcp tcp_largest_anon_port 65500

Verify change:



# ndd /dev/tcp tcp_smallest_anon_port tcp_largest_anon_port
# ndd /dev/udp udp_smallest_anon_port udp_largest_anon_port

NOTE: Changes will not be kept once rebooted - for more permanence.....
1. Create Startup script (SXXname).
# touch /etc/init.d/SXXname
2. Edit the permissions on the file
# chmod 755 SXXname
3. Confirm permissions
# ls -al
4. Create link from /etc/init.d to /etc/rc3.d
# ln -s /etc/init.d/SXXname /etc/rc3.d/SXXname

Startup script contents:

Name: SxxOracle11g
Content:
#!/usr/bin/ksh
ndd -set /dev/udp udp_smallest_anon_port 9000
ndd -set /dev/udp udp_largest_anon_port 65500
ndd -set /dev/tcp tcp_smallest_anon_port 9000
ndd -set /dev/tcp tcp_largest_anon_port 65500

Friday 1 June 2012

Solaris - Troubleshooting

During one of my Google hunts I found this useful site:

http://www.princeton.edu/~unix/Solaris/troubleshoot/index.html

The author of the pages, Scott Cromar, has a published the lot as a book. Which I would buy if it was in Kindle form....

After logging a call with Oracle with regards an intermittent issue with one of the servers (slows down, doesn't allow connections for 5 to 10 minutes - then is fine. Fault keeps repeating itself but nothing in the logs or showing up on Uptime) they recommended the following:

- GUDS - A script for gathering Solaris Performance Data [Doc ID: 1285485.1]
- Service Tools Bundle (specifically Explorer)
- Totally unresponsive server - kernel core dump
   <STOP><A>
   Taking you to the <ok> prompt, then type sync which causes a system panic
   See [Doc ID: 1004506.1] How do I Force a Crash Dump When my Solaris OS is Hung?

Another useful link which covers off resetting a root password on a non-ZFS and ZFS systems amongst others:
http://docs.oracle.com/cd/E19963-01/html/821-1451/gkkvy.html

Using Oracle STB:


Explorer

The default location for explorer is /opt/SUNWexplo/bin

(If the location doesn't exist then you'll have to search for it:
# find / -name explorer -print
which should print out on the screen the complete path to the file).

If you have an issue with a server running Zones
# explorer -w default,localzones

You will be prompted for SR number and the like.
Output from the query is stored at /opt/SUNWexplo/output - when the script finishes you are informed of the location.