RSS

Monthly Archives: June 2013

Re name Files

rename [Drive:][Path] filename1 filename2

ren [Drive:][Path] filename1 filename2

Examples

Suppose you want to change the extensions of all the file names in the current directory that have the extension .txt; for example, you want to change the .txt extensions to .doc extensions. To make this change, type:

ren *.txt *.doc

Examples

Rename Monday.txt as Tuesday.txt
C:\> REN Monday.txt Tuesday.txt

Substitute a character in the 1st and 3rd positions prior to any extension (adds a 2nd or 3rd character if it doesn’t exist yet)

ren  *  A?Z*
  1        -> AZ
  12       -> A2Z
  1.txt    -> AZ.txt
  12.txt   -> A2Z.txt
  123      -> A2Z
  123.txt  -> A2Z.txt
  1234     -> A2Z4
  1234.txt -> A2Z4.txt

Change the (final) extension of every file

ren  *  *.txt
  a     -> a.txt
  b.dat -> b.txt
  c.x.y -> c.x.txt

Append an extension to every file

ren  *  *?.bak
  a     -> a.bak
  b.dat -> b.dat.bak
  c.x.y -> c.x.y.bak

Remove any extra extension after the initial extension. Note that adequate ? must be used to preserve the full existing name and initial extension.

ren  *  ?????.?????
  a     -> a
  a.b   -> a.b
  a.b.c -> a.b
  part1.part2.part3    -> part1.part2
  123456.123456.123456 -> 12345.12345   (note truncated name and extension because not enough `?` were used)

Same as above, but filter out files with initial name and/or extension longer than 5 chars so that they are not truncated. (Obviously could add an additional ? on either end of targetMask to preserve names and extensions up to 6 chars long.)

ren  ?????.?????.*  ?????.?????
  a      ->  a
  a.b    ->  a.b
  a.b.c  ->  a.b
  part1.part2.part3  ->  part1.part2
  123456.123456.123456  (Not renamed because it doesn't match sourceMask)

Change characters after last _ in name and attempt to preserve extension. (Doesn’t work properly if _ appears in extension.)

ren  *_*  *_NEW.*
  abcd_12345.txt  ->  abcd_NEW.txt
  abc_newt_1.dat  ->  abc_newt_NEW.txt
  abcdef.jpg          (Not renamed because it doesn't match sourceMask)
  abcd_123.a_b    ->  abcd_123.a_NEW  (not desired, but no simple RENAME form will work in this case)

Any name can be broken up into components that are delimited by . characters may only be appended to or deleted from the end of each component. Characters cannot be deleted from or added to the beginning or middle of a component while preserving the remainder with wildcards. Substitutions are allowed anywhere.

ren  ??????.??????.??????  ?x.????999.*rForTheCourse
  part1.part2            ->  px.part999.rForTheCourse
  part1.part2.part3      ->  px.part999.parForTheCourse
  part1.part2.part3.part4   (Not renamed because it doesn't match sourceMask)
  a.b.c                  ->  ax.b999.crForTheCourse
  a.b.CarPart3BEER       ->  ax.b999.CarParForTheCourse

A sourceMask with at least 8 ? for the name and at least 3 ? for the extension will match all files because it will always match the short 8.3 name.

ren ????????.???  ?x.????999.*rForTheCourse
  part1.part2.part3.part4  ->  px.part999.part3.parForTheCourse
 
Leave a comment

Posted by on June 11, 2013 in Others

 

WARNING: inbound connection timed out (ORA-3136)

What the error is telling you is that a connection attempt was made, but the session authentication was not provided before SQLNET.INBOUND_CONNECT_TIMEOUT seconds.

As far as adverse effects in the long run, you have a user or process that is unable to connect to the database. So someone is unhappy about the database/application.
————————————————————————————————
In 10gR2, SQLNET.INBOUND_CONNECT_TIMEOUT the parameters were set to have a default of 60 (seconds).

Set the parameters SQLNET.INBOUND_CONNECT_TIMEOUT and INBOUND_CONNECT_TIMEOUT_listenername to 0 (indefinite).
Before setting SQLNET.INBOUND_CONNECT_TIMEOUT, verify that there is not a firewall or Network Address Translation (NAT) between the client and server. Those are common cause for ORA-3136.
————————————————————————————————
The parameter is to be added in sqlnet.ora on the server, so wont require a shutdown.
$ORACLE_HOME/network/admin/sqlnet.ora
and edit it at server side.

 
Leave a comment

Posted by on June 1, 2013 in Oracle

 

Software Setup Instructions before Installing Oracle 10g on Linux

1.     Open a terminal window. Login as the root user.

2.      Create the following operating system groups: oinstall, dba, and, oper.

/usr/sbin/groupadd oinstall

/usr/sbin/groupadd dba

/usr/sbin/groupadd oper

3.     Create the operating system user oracle:

/usr/sbin/useradd -g oinstall -G dba,oper -d /home/oracle oracle

4.     Enter the following command to set the password of the oracle user:

/usr/sbin/passwd oracle

5.     With an editor of your choice, edit /home/oracle/.bash_profile to include the following entries:

umask 022

 

PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin

LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib

 

ORACLE_BASE=/u01/app/oracle

ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1

ORACLE_SID=orcl

$ORACLE_HOME/jdk/jre/lib/i386/server:

$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/lib:$LD_LIBRARY_PATH

PATH=$ORACLE_HOME/bin:$PATH

 

export PATH LD_LIBRARY_PATH

export ORACLE_BASE ORACLE_HOME ORACLE_SID

6.     Create the directory for the software installation and assign ownership to oracle:oinstall.

mkdir -p /u01/app/oracle

chown -R oracle:oinstall /u01/app

chmod -R 775 /u01/app

7.     Open the /etc/sysctl.conf file in any text editor and add lines similar to the following:

kernel.sem = 250 32000 100 128

kernel.shmall = 2097152

kernel.shmmax = 2147483648

kernel.shmmni = 4096

fs.file-max = 65536

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default = 262144

net.core.rmem_max = 262144

net.core.wmem_default = 262144

net.core.wmem_max = 262144

 

8.     Issue the following command to set the kernel parameters:

/sbin/sysctl -p

9.  To see which versions of these packages are installed on your system, run the following command:

rpm -q binutils compat-db control-center gcc gcc-c++ glibc glibc-common \
gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio openmotif21

10. To install package:

rpm -Uvh glibc-devel-2.3.4-2.13.i386.rpm

 
1 Comment

Posted by on June 1, 2013 in Oracle

 

Lock/Unlock Oracle Users

In spite of deleting an oracle user, we can LOCK it. In that way the user won’t be accessible. In future if we want we can UNLOCK it.

create a user named JACK which is LOCKED:

SQL> create user jack identified by jack account lock;

User created.

Now grant him the CONNECT & RESOURCE privilege:

SQL> grant connect, resource to jack;

Grant succeeded.

Now, try to connect the user:

SQL> conn jack/jack;
ERROR:
ORA-28000: the account is locked

Warning: You are no longer connected to ORACLE.

Now, connect to the SYS accout:

SQL> conn sys as sysdba
Enter password:
Connected.
SQL>

Now, see the account status:

SQL> select USERNAME,ACCOUNT_STATUS,LOCK_DATE from dba_users where USERNAME=’JACK’;

USERNAME                       ACCOUNT_STATUS                   LOCK_DATE
------------------------------ -------------------------------- ---------
JACK                           LOCKED                           10-OCT-08

To, unlock the Jack:

SQL> alter user jack account unlock;

User altered.

SQL>
SQL> conn jack/jack;
Connected.

==================

Otherwise we can do one thing, we can revoke its CONNECT privilage. In that way the user can’t connect to the db.

SQL> revoke connect from jack;

Revoke succeeded.

SQL> conn jack/jack;
ERROR:
ORA-01045: user JACK lacks CREATE SESSION privilege; logon denied
Warning: You are no longer connected to ORACLE.

SQL> conn sys as sysdba
Enter password:
Connected.
SQL>
SQL> grant connect to jack;

Grant succeeded.

SQL>
SQL> conn jack/jack;
Connected.

 
Leave a comment

Posted by on June 1, 2013 in Oracle

 

Oracle Admin Command

lsnrctl start LISTENER

sqlplus /nolog

connect /as sysdba;

SHUTDOWN IMMEDIATE;

startup

alter user ESTABLISHMENT account unlock;

 
1 Comment

Posted by on June 1, 2013 in Oracle