Tuesday, March 16, 2010
Create Trace File for Concurrent Program
If your program is taking time to complete, then the best way to know what is causing the problem is by creating a trace file.
Navigation:
System Administrator(R) --> Concurrent --> Program --> Define
Query for the concurrent program and check enable trace button.
Now when the concurrent program is executed the trace file is created in the udump directory. The path of udump directory can be found by executing following query.
select * from v$parameter
where name like '%user_dump_dest%'
The trace file can be converted to a readable format by running a tkprof command over the trace file.
Syntax:
tkprof [trace_file_name] [new_file_name]
Understanding TKPROF
The TKPROF program can be used to format the contents of the trace file and convert it into a readable output file.
TKPROF can also be used to generate Explain Plan for the queries.
I will create a seperate post to discuss various options available with TKPROF.
Thanks & Regards,
Anto Joe Natesh I
Secure FTP the files from unix to windows
Securing FTP in shell scripts using .netrc
Often we use FTP in the shell scripts and for security reason it is advisable not to store username and password in the shell scripts.
Here I discuss how can we secure the FTP process and restrict sharing of username and passwords.
File .netrc in the $HOME directory allows file transfers in batch mode. This file stores the machine name, login and passwords. The FTP commands gets information from the file and connects to the FTP server.
Each record has the format:
machine machine_name login login_name password passwd
where machine_name, login_name, passwd refer to a system name with the login and password for that account on the machine
e.g machine xyz.server.com login anonymous password xyz123
There are following 2 ways to execute the FTP commands
1) Create a command file and store all the FTP commands in the file.
e.g. File command_ftp is created and saved. The file has following content
bin
cd /inbound
get abcd.txt
bye
Write following code in the shell script
ftp xyz.server.com < command_ftp
2) The FTP commands can also be stored in .netrc file as a macro and the commands will be executed with the FTP command.
The .netrc file content would be something like this
machine xyz.server.com login anonymous password xyz123
macdef bin
cd /inbound
get abcd.txt
bye
For this case the shell script will have following ftp command
e.g.
ftp xyz.server.com
The other way of securing FTP is by using the sftp(secure FTP) commands which is a network protocol that provides file transfer and transfers file in a secure way.
Thanks & Regards,
Anto Joe Natesh I
Sunday, December 6, 2009
FNDLOAD & WHO Columns
Usually if we download the DFF using fndload from UAT instance and upload into the PROD instance. The WHO Columns will be defaulted to the creation date in the UAT instance. If we want to change the creation date as sysdate. We need to alter the particular afffload.lct file.
Open the lct file by doing vi $FND_TOP/patch/115/import/afffload.lct
Search for string fnd_flex_loader_apis.up_desc_flex
In the parameter last_update_date you can pass sysdate, replacing the value read from ldt file.
Thanks & Regards,
Anto Joe Natesh I
Open the lct file by doing vi $FND_TOP/patch/115/import/afffload.lct
Search for string fnd_flex_loader_apis.up_desc_flex
In the parameter last_update_date you can pass sysdate, replacing the value read from ldt file.
Thanks & Regards,
Anto Joe Natesh I
Wednesday, November 25, 2009
Brace {} in shell script
- Brace is used for expansion. If several words are separated by commas and surrounded by brace then in case of expansion the word/words before the brace is added to each word/words within brace and the word after the brace is suffixed to each word/words within the brace.
Following is an example of appending "Vision" keyword to each words within brace at first and " always." keyword appends to each words within brace at last.
$ echo 'The '{'Virtual','only'}' Vision. '
The Virtual Vision. The only Vision.
- With combination of brace and and cat command we can concatenate several files contents into one. Following is an example.
$ cat >file1.txt
one
$ cat >file2.txt
two
$ cat >file3.txt
three
$ cat {file1.txt,file2.txt,file3.txt} >file5.txt
$ cat file5.txt
one
two
three
- We can take facility of brace expansion while move or copy or rename files. For example the following can be used to rename a .txt file to .bak file.
$ cat file5.txt
one
two
three
$ mv file5.{txt,bak}
$ cat file5.bak
one
two
three
- Note that no spaces are allowed within the braces unless the spaces are quoted or escaped.
- With double dot we can use extended brace expansion construction which is a feature introduced in version 3 of Bash.
Example:
$ echo {a..m}
a b c d e f g h i j k l m
$ echo {5..10}
5 6 7 8 9 10
- The {} double curly brackets are a placeholder for output text. For example, curly brackets are placeholder for the path name output by "find".
DELETE_DIR=/home/test/junk
find "$DELETE_DIR" -type f -atime +30 -exec rm {} \;
The above script deletes the files from "/home/test/junk" that have not been accessed in at least 30 days (plus sign ... +30).
where,
-type indicates filetype", and
f = regular file
Thanks & Regards,
Anto Joe Natesh I
Following is an example of appending "Vision" keyword to each words within brace at first and " always." keyword appends to each words within brace at last.
$ echo 'The '{'Virtual','only'}' Vision. '
The Virtual Vision. The only Vision.
- With combination of brace and and cat command we can concatenate several files contents into one. Following is an example.
$ cat >file1.txt
one
$ cat >file2.txt
two
$ cat >file3.txt
three
$ cat {file1.txt,file2.txt,file3.txt} >file5.txt
$ cat file5.txt
one
two
three
- We can take facility of brace expansion while move or copy or rename files. For example the following can be used to rename a .txt file to .bak file.
$ cat file5.txt
one
two
three
$ mv file5.{txt,bak}
$ cat file5.bak
one
two
three
- Note that no spaces are allowed within the braces unless the spaces are quoted or escaped.
- With double dot we can use extended brace expansion construction which is a feature introduced in version 3 of Bash.
Example:
$ echo {a..m}
a b c d e f g h i j k l m
$ echo {5..10}
5 6 7 8 9 10
- The {} double curly brackets are a placeholder for output text. For example, curly brackets are placeholder for the path name output by "find".
DELETE_DIR=/home/test/junk
find "$DELETE_DIR" -type f -atime +30 -exec rm {} \;
The above script deletes the files from "/home/test/junk" that have not been accessed in at least 30 days (plus sign ... +30).
where,
-type indicates filetype", and
f = regular file
Thanks & Regards,
Anto Joe Natesh I
Dot (.) in linux and shell script
- Dot(.) is equivalent the source command in shell script and linux command line. From command line we can execute a shell script using dot (.). Within a script, a "source file_name" or ". file_name" loads the file file_name. The command "source" or "." just imports code into the script, appending to the script (it is same like include command in php or #include in c). The net result is the same as if the "sourced" lines of code were physically present in the body of the script. This technique is useful in situations when multiple scripts use a common data file or function library.
Let's assume that my welcome.sh is like below which later included using . within main.sh file.
$ cat >welcome.sh
echo "Welcome to shell script programing"
$ cat >main.sh
. welcome.sh
echo "This is main file"
$ sh main.sh
Welcome to shell script programing
This is main file
- Dot (.) is the part of the hidden file name. A leading dot is the prefix of a "hidden" file.
$ ls
main.sh newfile semicolon_test.sh welcome.sh
$ touch .hidden_file
$ ls
main.sh newfile semicolon_test.sh welcome.sh
$ ls -a
. .. .hidden_file main.sh newfile semicolon_test.sh welcome.sh
In the example ls -a shows the hidden file .hidden_file
- When working with directory, a single dot (.) represents the current working directory, and two dots (..) represent the parent directory.
Example:
$ pwd
/home/test/t_dir
$ cd .
$ pwd
/home/test/t_dir
$ cd ..
$ pwd
/home/test
- While copying files we can use dot (.) to represent current directory.
The following example will copy the file /home/test/f to present working directory.
$ cp /home/test/f .
Thanks & Regards,
Anto Joe Natesh I
Let's assume that my welcome.sh is like below which later included using . within main.sh file.
$ cat >welcome.sh
echo "Welcome to shell script programing"
$ cat >main.sh
. welcome.sh
echo "This is main file"
$ sh main.sh
Welcome to shell script programing
This is main file
- Dot (.) is the part of the hidden file name. A leading dot is the prefix of a "hidden" file.
$ ls
main.sh newfile semicolon_test.sh welcome.sh
$ touch .hidden_file
$ ls
main.sh newfile semicolon_test.sh welcome.sh
$ ls -a
. .. .hidden_file main.sh newfile semicolon_test.sh welcome.sh
In the example ls -a shows the hidden file .hidden_file
- When working with directory, a single dot (.) represents the current working directory, and two dots (..) represent the parent directory.
Example:
$ pwd
/home/test/t_dir
$ cd .
$ pwd
/home/test/t_dir
$ cd ..
$ pwd
/home/test
- While copying files we can use dot (.) to represent current directory.
The following example will copy the file /home/test/f to present working directory.
$ cp /home/test/f .
Thanks & Regards,
Anto Joe Natesh I
Saturday, November 21, 2009
Oracle Database Links (DB Link)
A database link is a path through which a remote user in another database can connect to any other database. Once created the database link exists as an object in the user schema.
Type of DB Links
There are 3 types of DB links. They are as follows:
1. PRIVATE: When the DB links is created, it is created under Private mode as default. The Private DBLINK is only available to the user who has created it. It is not possible for a user to grant access on a private DBLINK to other users.
2. PUBLIC: The Public DBLINK is available to all the users and all users can have the access without any restrictions.
3. SHARED: Shared database link uses share the server connection to support database link connection. If there are multiple concurrent database link access into a remote database, shared database link can be used to reduce the number of server connections required. Without the shared clause each database link connection requires a separate connection to the remote database.
Types of Logins:
In dblink we can use 2 types of login. They are as follows:
1. DEFAULT LOGIN: The User name and Password is same in both the databases.
Syntax
======
CREATE [PUBLIC] DATABASE LINK CONNECT TO CURRENT_USER USING
Code: (Text)
Create public database link daslink connect to current_user using ‘ORCL’
2. EXPLICIT LOGIN: The User Name and Password is different in both the databases.
Syntax
======
CREATE [PUBLIC|SHARED] DATABASE LINK CONNECT TOIDENTIFIED BY USING
Code: (text)
CREATE PUBLIC DATABASE LINK DDLNK CONNECT TO SCOTT IDENTIFIED BY TIGER USING ‘ORCL’
Note: To create the public DBLINK the user must have create public database link system privileges.
Friday, November 13, 2009
Subscribe to:
Posts (Atom)
