POUWIEL|COM

JeroenPouwiel

Find and move files

find . -type f -mtime -1 -exec mv ‘{}’ /ora/bin \;

This will move all files found that were created that day to the directory /ora/bin.

Useradd on Solaris 11.2

useradd -u 200 -d /export/home/oracle -g oinstall -G dbadmin -m -s /bin/bash -c “RDBMS install user” oracle

Now, what does it mean?
-u = userid (it is convenient to keep this the same on multiple systems)
-d = home directory
-m = make the home directory if it doesn’t exist (believe me, it’s quite frustrating if you don’t (know) use this one.)
-s = which shell to use
-c = comment about the user

and at the end the user’s username.

source https://docs.sun.com/

UPDATE::
I noticed that the order in which the flags are given are important on version 11.2:

source https://docs.oracle.com/ & Jeff Taylor’s Weblog

And let’s add some X11 related packages in the mix so we can connect via an X-terminal:
pkg install xauth
pkg install x11/diagnostic/x11-info-clients
pkg install xclock
pkg install library/motif

Mailing from *nix

So, a couple of updates since last or last-er:

Using mailx to send a mail with attachment:

mailx -m -r sender_user@example.org -s "Subject header" -a /file/to/attach.log receiver_user@example.org

With uuencode to attach a file:

uuencode <source_file> <target_file> | mailx -m -r sender_user@example.org -s "Subject header" receiver_user@example.org

With mutt to attach a file:

echo "This is the message body" | mutt -a "/file/to/attach.log" -s "Subject header" -- receiver_user@example.org

Find and delete files older than today in current directory

find . -mtime +0 -exec rm -f {} \;

or

find /any/directory/you/may/have/ -type f -mtime +15 -exec rm -f {} +

find and do things

Attach to datapump job when jobname is in lowercase

server01(database01):/home/oracle>expdp userid=dpuser ATTACH='\"dpjob1414698371\"'

Export: Release 10.2.0.4.0 - 64bit Production on Wednesday, 06 February, 2013 14:25:31

Copyright (c) 2003, 2007, Oracle.  All rights reserved.
Password:

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Job: dpjob1414698371
  Owner: DPUSER
  Operation: EXPORT
  Creator Privs: FALSE
  GUID: D421B4DB34AE6236E04400144F2ABBF8
  Start Time: Wednesday, 06 February, 2013 14:25:38
  Mode: SCHEMA
  Instance: database01
  Max Parallelism: 1
  EXPORT Job Parameters:
  Parameter Name      Parameter Value:
     DATA_ACCESS_METHOD    AUTOMATIC
     ESTIMATE              BLOCKS
     INCLUDE_METADATA      1
     KEEP_MASTER           0
  State: IDLING
  Bytes Processed: 9,289,692,760
  Percent Done: 60
  Current Parallelism: 1
  Job Error Count: 0
  Dump File: /oradump/20130125_1414698371.dmp01
    bytes written: 9,977,094,144
  Dump File: /oradump/20130125_1414698371.dmp%u

Worker 1 Status:
  State: UNDEFINED
  Object Schema: SCHEMASOURCE
  Object Name: WORKFLOW_PROCESS
  Object Type: SCHEMA_EXPORT/TABLE/TABLE_DATA
  Completed Objects: 15
  Total Objects: 583
  Worker Parallelism: 1

Export> kill_job
Are you sure you wish to stop this job ([yes]/no): yes

FIND | SED

Just a quick bite:
find and pre-/append for formatting datafiles to use in create controlfile script:

find /m*/oradata/${SID} -type f | sed "s/^/'/;s/$/'/"

Result:

'/m001/oradata/database01/database01pdtdc00101.dbf'
'/m001/oradata/database01/database01posdl01.dbf'
'/m001/oradata/database01/database01posdm03.dbf'
'/m001/oradata/database01/database01sysaux01.dbf'
'/m002/oradata/database01/database01pserrc00201.dbf'
'/m002/oradata/database01/database01phvcf00101.dbf'

Creating raidz zpool with ZIL, mirrored cache and spares

Creating raidz zpool with ZIL, mirrored cache and spares == {Pretty straightforward}: Read the rest of this entry »

Mirroring the rpool

As you may notice below, this is a VM with plenty of disks, the intention is to have a mirrored rpool with a ZFS ZIL. There are two 16Gb disks for the rpool, one 10Gb disk for the ZIL and ten (10) 5Gb disks for a RAIDZ2 zpool. This post will show how to mirror the rpool on Solaris Express 11, it is a shameless ctrl-c/ctrl-v of this blogpost. But it works none-the-less… Read the rest of this entry »

Oracle Solaris 11 Express: change from nwam DHCP to ipadm static IP

So, way back when I wrote this post, I thought I was done with it.

Seems the procedure described then, isn’t any good now. At least, come Hell or high water, I could not get a static IP and enjoy it…
Till this pdf crossed my digital path, and sure enough… I got a static IP which worked (skip to page 17: “Configuring Network Resources”).
Below the transcript: Read the rest of this entry »

Display IRQ settings in OpenSolaris

Source: click

Essentially it comes down to this, as root: Read the rest of this entry »

unable to qualify my own domain name

Received sendmail errors, looked it up on internet. Turns out I didn’t fill out my /etc/hosts file correctly.
Here’s what’s what: Read the rest of this entry »

Mounting NTFS usb HDD on OpenSolaris

Not sure if I ever posted this before. Couldn’t find it none the less, so here goes:

To be able to mount NTFS and/or EXT2fs usb HDD, read this post on OpenSolaris forums. It will give a link to genunix where you can download 2 packages and a txt file with instructions.

Works every time, wish I could say the same for the functionality of smb/server.

Fixing the network configuration on my OpenSolaris box

If you have read this post, then you would have known i have this motherboard and that it has two nic’s. Now during the installation, i just went with the default and that means it is automatically configured via nwam (see this pdf -page 11- or this page, they’re practically the same!). Of course, i can’t have that…

So, here’s howto configure it manually, just the way you like it:
First, see what the status is of – and disable nwam: Read the rest of this entry »

OpenSolaris 2008.11 xVM Hypervisor

So, here i am. Trying to setup a Solaris xVM hypervisor….
Installed OpenSolaris using the ‘install’ icon on the desktop of the livecd.

According to the package manager, SUNWxvmdom, SUNWxvmipa and SUNWxvmpv were already installed, so i downloaded the rest (available via the package repository from opensolaris.org): SUNWvirtinst, SUNWvirt-manager and SUNWxvm. Those 3 were prox. 8 Mb in size. Read the rest of this entry »

T-bit and S-bit on *nix

Just came across a directory with these permissions: drwxr-sr-x

Here’s howto set it:

chmod 2755 

Here are the sources: example man

Useradd on Solaris

useradd -u 200 -d /export/home/oracle -g oinstall -G dbadmin -m -s /bin/bash -c “RDBMS install user” oracle

Now, what does it mean?
-u = userid (it is convenient to keep this the same on multiple systems)
-d = home directory
-m = make the home directory if it doesn’t exist (believe me, it’s quite frustrating if you don’t (know) use this one.)
-s = which shell to use
-c = comment about the user

and at the end the user’s username.

source https://docs.sun.com/

UPDATE::
I noticed that the order in which the flags are given are important on version 11.2:
/usr/sbin/useradd -u 54321 -m -d /export/home/oracle -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba -s /bin/bash -c “RDBMS install user” oracle
/usr/sbin/useradd -u 54322 -m -d /export/home/grid -g oinstall -G asmadmin,asmdba,dba -s /bin/bash -c “INFRASTRUCTURE install user” grid

source https://docs.oracle.com/ & Jeff Taylor’s Weblog

Find and do things in *nix

Find stuff in *nix:

find /file_system/file_system -name file_name -type f -exec rm {} ;
What this does is, find files (-type f) with the name file_name in given file_system and executes rm

Kill a nohup process

Of course you can use kill -9 pid, but sometimes you just can’t find the pid.
In that case try: fg.

Log in as root from other than /dev/console

Edit /etc/default/login with your editor (probably vi). Navigate to the line which reads
Read the rest of this entry »

Apache2 on Solaris 10

This is a perfect howto for enabling Apache2 on a Solaris machine.
Click here if you want SAMP. The article refered to on Blastwave, is here (link doesn’t work)
Read this to configure your system for DNS. Or this one…
This one is nice too, it’s an overview of a lot of manuals/howto’s.

Solaris + MD5

Whadda ya’ know, Solaris doesn’t come shipped with MD5 but (!) using digest, you can come a long way:
Read the rest of this entry »

UFS: export a filesystem to a container,..

UFS: export a filesystem to a container and remove the filesystem from the configuration:
Read the rest of this entry »

Counting lines on *nix

To count number of process occurrences on *nix:

ps -ef|grep search_attribute|wc -l

Tarring

Create TAR file:
tar -cvf archive_file.tar file_to_archice.doc

Append a file to a TAR file:
tar -uvf archive_file.tar file_to_archice.doc

Extract a TAR file:
tar -xvf archive_file.tar directory_to_extract

List the contents of a TAR file:
tar -tvf archive_file.tar

Read the rest of this entry »

Remove an entire directory in *nix

Even when it’s used:

rm -rf /file_system/file_system/fil…..

Disk Usage in *nix

du -h /file_system | sort -n | tail -10 grep -v parameter

What this does is, give a result with the items in a given file system that sorted according to their size and only the top ten.
The grep -v excludes the parameter given.

Mailing from unix

If you regard mailing from unix as quite a hassel, see the following:
uuencode old_file_name new_file_name | mailx -r reply_address -s “subject” to_address

In this manner, the file that you send with mailx, will be attached via uuencode.
If you need to send more files, tar hem.

Categories