IBM AIX

DBA Related commands:-



Finding files (find command)
Use the find command to recursively search the directory tree for each specified Path, seeking files that match a Boolean expression written using the terms given in the following text.
The output from the find command depends on the terms specified by the Expression parameter.
The following are examples of how to use the find command:
·         To list all files in the file system with the name .profile, type the following:
find / -name .profile
Below command need to find  sonu file location.

bash-4.2$ find / -name sonu 2>/dev/null



This searches the entire file system and writes the complete path names of all files named .profile. The slash (/) tells the find command to search the /(root) directory and all of its subdirectories.
To save time, limit the search by specifying the directories where you think the files might be.
·         To list files having a specific permission code of 0600 in the current directory tree, type the following:
find . -perm 0600
This lists the names of the files that have only owner-read and owner-write permission. The dot (.) tells the find command to search the current directory and its subdirectories. For an explanation of permission codes, see the chmod command.
·         To search several directories for files with certain permission codes, type the following:
find manual clients proposals -perm -0600
This lists the names of the files that have owner-read and owner-write permission and possibly other permissions. The manual, clients, and proposals directories and their subdirectories are searched. In the previous example, -perm 0600 selects only files with permission codes that match 0600 exactly. In this example, -perm -0600 selects files with permission codes that allow the accesses indicated by 0600 and other accesses above the 0600 level. This also matches the permission codes 0622 and 2744.
·         To list all files in the current directory that have been changed during the current 24-hour period, type the following:
find . -ctime 1
·         To search for regular files with multiple links, type the following:
find . -type f -links +1
This lists the names of the ordinary files (-type f) that have more than one link (-links +1).
Note: Every directory has at least two links: the entry in its parent directory and its own .(dot) entry. 
·         To search for all files that are exactly 414 bytes in length, type the following:

find . -size 414c

How to check Mount Point

bash-3.2$ df -g
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4           5.00      2.63   48%     6665     2% /
/dev/hd2           5.00      0.66   87%    48058    24% /usr
/dev/hd9var        5.00      3.51   30%    18638     3% /var
/dev/hd3           5.00      4.19   17%      424     1% /tmp

AIX version 
function aixversion {
  OSLEVEL=$(oslevel -s)
  AIXVERSION=$(echo "scale=1; $(echo $OSLEVEL | cut -d'-' -f1)/1000" | bc)
  AIXTL=$(echo $OSLEVEL | cut -d'-' -f2 | bc)
  AIXSP=$(echo $OSLEVEL | cut -d'-' -f3 | bc)
  echo "AIX ${AIXVERSION} - Technology Level ${AIXTL} - Service Pack ${AIXSP}"
}
aixversion
Example output:
AIX 7.1 - Technology Level 3 - Service Pack 1
General Commands
  • id - displays the system identity of the user
  • lslicense - list maximum number of users
  • last - information about previous logins
  • w - lists summary of current users
  • who - displays information about all current users
  • uname - displays system info
  • type - shows path location
  • whereis - shows path location
  • what - displays header information about the source file
  • whatis - displays a short description of a function
  • basename - returns the base file name
  • ac - displays connect time
  • date - displays or sets the date
  • timex - displays the elapsed time
  • cmp - compares two files
  • diff - compares text files
  • head or tail - display start or end of file
  • od - dumps the contents of a file
  • split - makes smaller files from a large one
  • cut - cuts out selected text
  • tr - translates characters
  • sed - stream edit command to change text
  • nl - produces an OUTPUT file by inserting the line number
  • captoinfo - converts termcap to terminfo
  • nvdmetoa - convert EBCDIC files to ASCII
  • sum - displays checksum for a file
  • errclear - deletes entries in the error log
  • errpt - generates an error report
  • diag - performs hardware problem determination
  • trace - kernel debugging
  • at - schedules jobs
  • batch - run 1 or more jobs in the background
  • nice - execute a command at a lower priority
  • tee - used to preserve output from a pipeline
  • find - finds files with matching expressions
  • grep - searches a file for a pattern
  • kill - stop a process
  • stopsrc - gracefully shuts down all subsystems
  • shutdown - shutdown system
  • fastboot - restarts the system without running fsck
  • fasthalt - halts the system
  • lsitab - list contents of the /etc/inittab file
  • rmitab - removes an entry from the /etc/inittab
  • telinit - forces the init process to re-read the /etc/inittab
  • strip - removes symbol table
  • xargs - constructs an argument list




find
Finds files with matching expressions.
Note: If the following error message is generated find: 0652-081 cannot change directory to </transfer/printers>: file access permissions do not allow the specified action. This means that the user you are currently logged in as (even root) doesn't have the authority to READ that directory.

ExamplesWhat it does
find / -name jan92.rpt -printSearch all file systems for any file named jan92.rpt
find / -size +1000k -exec ls -l {} \; -printSearches all file systems to report back those files larger than 1MB in size
find / -size 0 -printFind all files of ZERO length
find / -type f -exec grep bananas {} \; -printSearches all plain files to determine if the string 'bananas' is contained within it
find /usr/lpp/FINANCIALS -print | xargs chown roger.staffChanges the ownership of all files under /usr/lpp/FINANACIALS to be owned by user roger and have a group ownership of staff.
find / -user roger -printFind all files owned by user roger
find / -nouser -printDisplays all unowned files in the system
find / -group staff -printFind all files owned by group staff
find / -nogroup staff -printList all files that belong to a non-existent group not found in /etc/group
find . -perm 600 -print | xargs chmod 666Find all the files that have READ/WRITE permissions set for the owner of a file and change those permissions to READ/WRITE for everybody.
find / -mtime +100 -printSearch all file systems for files that have not be modified in over 100 days.
find . -mtime 0 -printList all files in the current directory that have changed during the current 24 hour period.
find / -name /transfer -prune -o -printList the name of all files from the / (root) directory except for the NFS file system named /transfer
find . -name PERSONAL -prune -o -printList the name of all files in or below the current directory, except the directory named PERSONAL or files in that directory.
find / -fstype nfs -printList the name of all the files that reside in an NFS file system
find . -newer disk.log -printDisplay all files that have been modified more recently than the file named disk.log


grep
Searches a file for a pattern. Grep stands for Global Regular Expression Printer

ExamplesWhat it does
grep -i WhereIs *Search all files in current directory to determine if the string 'WhereIs' is contained within it. The -i option ignores the case of letters (WhereIs is same as whereis)
lsdev -C|grep lpList all configured printers
grep [0-9][A-Z] *.docList any file that has a .doc suffix that contains a number (0-9) followed by a capital letter (A-Z).
grep [^0-5][A-Z] *.docList any file that has a .doc suffix that contains any number except 0 to 5 and is followed by a capital letter (A-Z)
grep "^IBM" *.docDisplays lines that BEGIN with the word IBM
grep "IBM$" *.docDisplays lines that END with the word IBM
grep "^IBM is GREAT$" *.docDisplays only those lines that consist of the phrase 'IBM IS GREAT'
grep -v "^ *$" testfile > goodfileRemoves all the blank lines from the source file 'testfile' and redirects the output to a new file named 'goodfile'.

No comments:

ORA-00059: Maximum Number Of DB_FILES Exceeded in 19C database

When I am adding datafile to my 19C database facing the below error. SQL> alter tablespace DATA  add datafile '/u01/data/data15.dbf...