lofiadm -a /image-dir/image-name.iso
/dev/lofi/1
mount -F hsfs -o ro /dev/lofi/1 /mnt
Showing posts with label System Administration. Show all posts
Showing posts with label System Administration. Show all posts
Mount an ISO image on Solaris
Labels:
Solaris,
System Administration
Script to create Standard Groups, Users, and Paths on Solaris 10
#!/bin/ksh # Example of Creating Standard Groups, Users, and Paths # From Oracle Grid Infrastructure Installation Guide 11g Release 2 (11.2) for Oracle Solaris E24616-01 groupadd -g 1000 oinstall groupadd -g 1020 asmadmin groupadd -g 1021 asmdba groupadd -g 1031 dba useradd -m -d /export/home/grid -s /bin/bash -u 1100 -g oinstall -G dba,asmadmin grid passwd grid useradd -m -d /export/home/oracle/ -s /bin/bash -u 1101 -g oinstall -G dba,asmdba oracle passwd oracle mkdir -p /u01/app/11.2.0/grid mkdir -p /u01/app/grid chown -R grid:oinstall /u01 mkdir /u01/app/oracle chown oracle:oinstall /u01/app/oracle chmod -R 775 /u01/ mkdir /opt/oracle mkdir /opt/oraInventory chown oracle:oinstall /opt/oracle chown oracle:oinstall /opt/oraInventory chmod 755 /opt/oracle chmod 755 /opt/oraInventory
Labels:
Installation,
Solaris,
System Administration
Add swap space to Solaris 10 zfs
# zfs create -V 16gb rpool/newswap
# swap -a /dev/zvol/dsk/rpool/newswap
Labels:
Installation,
Solaris,
System Administration
Configure Yum on Linux to read from a local repository
This has been tested on Red Hat Linux 5.4.
This example assumes you have an ISO image stored on an NFS volume.
Mount the NFS volume
Mount the ISO image
Create a local repository file and point it to the ISO image
From here you should be able to use Yum normally with your local repository.
This example assumes you have an ISO image stored on an NFS volume.
Mount the NFS volume
mount -t nfs <Host Name or IP Address>:/<Path to Directory with ISO> <Local Mount Point>
Example:
mount -t nfs MyVolHost:/isodir /mnt
cd /mnt
Mount the ISO image
mount -o loop image-name.iso /mnt2
Create a local repository file and point it to the ISO image
vi /etc/yum.repos.d/local.repo
[local]
name=Red Hat Local Repository
baseurl=file:///mnt2/Server
enabled=1
gpgcheck=0
From here you should be able to use Yum normally with your local repository.
Labels:
Linux,
System Administration
Configure vi so it doesn't clear screen on Linux
When using Linux I noticed that it clears the screen after quitting out of the file you were editing. If you do not like this behavior here is how to avoid it.
Apparently on most distros of Linux vi is an alias of vim.
Create or edit a file named .vimrc in your home directory and add the following line:
Now vi will behave the same on Linux as it does on other flavors of UNIX.
This has been tested on Red Hat 5.
Apparently on most distros of Linux vi is an alias of vim.
Create or edit a file named .vimrc in your home directory and add the following line:
set t_ti= t_te=
Now vi will behave the same on Linux as it does on other flavors of UNIX.
This has been tested on Red Hat 5.
Labels:
Linux,
System Administration
Run UNIX shell script from Stored Procedure via DBMS_SCHEDULER
When you try to run a UNIX shell script directly from DBMS_SCHEDULER it runs as the UNIX owner nobody:nobody, which means it will likely have permissions problems and give the error ORA-27369. It is possible to configure DBMS_SCHEDULER so it will run as the oracle user (Metalink Doc ID 389685.1) but if you can't or don't want to do that you can do this:
First you have to give Java permission to access the script:
After that create the Java procedure itself:
Then a function that calls the java procedure:
And finally the stored procedure:
After that it can be run from DBMS_SCHEDULER like this:
Of course it can also be set up with a schedule, etc. like any other stored procedure.
First you have to give Java permission to access the script:
begin
dbms_java.grant_permission
('SYS',
'java.io.FilePermission',
'[path]/test.sh',
'execute');
dbms_java.grant_permission
('SYS',
'java.lang.RuntimePermission',
'*',
'writeFileDescriptor' );
end;
After that create the Java procedure itself:
create or replace and compile
java source named "Util"
as
import java.io.*;
import java.lang.*;
public class Util extends Object
{
public static int RunThis(String args)
{
Runtime rt = Runtime.getRuntime();
int rc = -1;
try
{
Process p = rt.exec(args);
int bufSize = 4096;
BufferedInputStream bis =
new BufferedInputStream(p.getInputStream(), bufSize);
int len;
byte buffer[] = new byte[bufSize];
// Echo back what the program spit out
while ((len = bis.read(buffer, 0, bufSize)) != -1)
System.out.write(buffer, 0, len);
rc = p.waitFor();
}
catch (Exception e)
{
e.printStackTrace();
rc = -1;
}
finally
{
return rc;
}
}
}
/
Then a function that calls the java procedure:
create or replace
function RUN_CMD(p_cmd in varchar2) return number
as
language java
name 'Util.RunThis(java.lang.String) return integer';
/
And finally the stored procedure:
create or replace procedure RC(p_cmd in varchar2)
as
x number;
begin
x := run_cmd(p_cmd);
end;
/
After that it can be run from DBMS_SCHEDULER like this:
SQL>BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'MyJob',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN rc(''[path]/test.sh''); END;',
start_date => SYSTIMESTAMP,
end_date => NULL,
enabled => TRUE,
comments => 'UNIX shell script run from stored procedure');
END;
/
PL/SQL procedure successfully completed.
Of course it can also be set up with a schedule, etc. like any other stored procedure.
Labels:
DBA,
Linux,
Solaris,
System Administration
Oracle install ships with unzip
If you need unzip on a system where it is not installed, check $ORACLE_HOME/bin.
You can also use jar -xvf.
You can also use jar -xvf.
Labels:
DBA,
Installation,
System Administration
List all ORACLE_SIDs and their home directories on a server (UNIX)
Look in oratab, typically located in /var/opt/oracle or the /etc directories.
$ more /var/opt/oracle/oratab
#
ora9:/oracle/product/10.2.0/db_1:N
EIC:/oracle/product/10.2.0/db_1:N
cmstdev:/oracle/product/10.2.0/db_1:N
Labels:
Configuration,
DBA,
Linux,
Solaris,
System Administration
Backup and disable crontab
#!/bin/ksh
export CRONTABFILE=crontab.`date +%m%d%y-%H%M%S`
echo Exporting crontab to $CRONTABFILE
crontab -l > $CRONTABFILE
crontab -r
export CRONTABFILE=crontab.`date +%m%d%y-%H%M%S`
echo Exporting crontab to $CRONTABFILE
crontab -l > $CRONTABFILE
crontab -r
Labels:
Linux,
Solaris,
System Administration
Set prompt to show current directory (ksh)
PS1="[$LOGNAME@`'hostname'`]"' $PWD>: '
export PS1
export PS1
Labels:
Linux,
Solaris,
System Administration
Troubleshoot client connection problems
1. Check whether you can ping the server from the client machine.
2. If pinging then check whether service is started on server.
3. If service started then check the listener.
4. If listening then check your tnsnames.ora file.
2. If pinging then check whether service is started on server.
3. If service started then check the listener.
4. If listening then check your tnsnames.ora file.
Labels:
DBA,
System Administration
Subscribe to:
Posts (Atom)