SAP NetWeaver Newbie

UNIX command tricks

Some of the day to day UNIX commands used by a Basis admin have been covered by one of my previous posts. Here are some tips and tricks you might find usable.

UNIX command tricks

Replace a string from previous command and execute

If you have run a command with an incorrect argument (usually a typo), you need not retype the entire command. You can use this trick to replace the typo and run the command.

In this example, I am trying to list a file, but I typed the file name wrong:

sapnwnewbie:user1 2> ls -l i-made-a-typo
i-made-a-typo not found

Now I correct the typo, and typo alone, using ^ in front of replacement and error. The corrected command runs automatically.

sapnwnewbie:user1 3> ^i-made-a-typo^startsap.trc
ls -l startsap.trc
-rw-r--r--   1 user1     group1       33155 Apr 17 03:03 startsap.trc

Reusing last argument from the previous command

This is useful if you have used an argument in a command and if you need to use it again this time. Only the last argument can be reused in this trick; but that is quite a common occurrence in a real life case.

In this example, I have copied a file to a different directory. I will reuse the last argument in the command (the directory path)

sapnwnewbie:user1 4> pwd
/home/user1
sapnwnewbie:user1 5> cp test_delete_this_file /usr/sap/DEV/DVEBMGS01

Now I will reuse /usr/sap/DEV/DVEBMGS01, which is stored in !$

sapnwnewbie:user1 6> cd !$
cd /usr/sap/DEV/DVEBMGS01
sapnwnewbie:user1 7> pwd
/usr/sap/DEV/DVEBMGS01

Execute the command again, by replacing the last argument
This runs against the use case of the previous trick. This time we will use everything from the previous command, except the last argument.

I have copied a file to a particular location

sapnwnewbie:user1 78> cp remove_this_file /usr/sap/DEV

Now I want to copy the came file to a different location. So the command is the same one except for the last argument. The command, sans last argument, is stored in !:-

sapnwnewbie:user1 79> !:- /usr/sap/DEV/DVEBMGS01
cp remove_this_file /usr/sap/DEV/DVEBMGS01

Jump to a directory, execute a command and jump back to current directory

All I need to do is && operator and type the command in parenthesis ().

In this example, I will change to a new directory location (cd /usr/sap/DEV). Run a command from the new directory location (ls -ltr) and when done I will be back to the directory where I started off (/home/user1). The && is an AND operator. In this example ls -ltr will run only if cd to /usr/sap/DEV was successful. If changing to new directory failed, the command execution will return a false, and false ANDed with true/false is false. Therefore the shell won't bother executing ls -ltr.

sapnwnewbie:user1 21> (cd /usr/sap/DEV && ls -ltr)
total 1224
drwxr-xr-x   2 root       sys             96 Jun 29  2006 global
drwxr-xr-x   5 user1     sapsys          96 Jan 31  2016 SYS
drwxr-xr-x   7 user1     sapsys          96 Jan 31  2016 SCS00
drwxr-xr-x   2 user1     sapsys          96 Jan 31  2016 put
drwxr-xr-x   2 user1     sapsys          96 Jan 31  2016 config
drwxr-xr-x   9 user1     sapsys        1024 Apr 19 09:35 DVEBMGS01
sapnwnewbie:user1 22> pwd
/home/user1

Rename a file or take a backup

When renaming a file name or taking a backup of a file, if you are using the most part of the file name, you can avoid typing it in twice. The changing part is specified in {}.

In this example, I have a file named testfile.old and I am renaming it to testfile.new.

sapnwnewbie:user1 39> ls -l testfile.old
-rw-r--r--   1 user1     group1           0 Apr 19 10:08 testfile.old
sapnwnewbie:user1 40> mv testfile.{old,new}
sapnwnewbie:user1 41> ls -l testfile.old
testfile.old not found
sapnwnewbie:user1 42> ls -l testfile.new
-rw-r--r--   1 user1     group1           0 Apr 19 10:08 testfile.new

I will use similar trick to take a backup of a file.

sapnwnewbie:user1 121> cp remove_this_file{,.bck}
sapnwnewbie:user1 122> ls -l remove_this_file*
-rw-r--r--   1 user1     group1           0 Apr 19 10:23 remove_this_file
-rw-r--r--   1 user1     group1           0 Apr 19 11:41 remove_this_file.bck

There are some more tricks. I'll post them later.

My SAP HANA Bookmarks

Here is a list of online resources relevant to SAP Basis support for SAP HANA. I will keep adding to this list as I discover more. Leave a comment if you would like to have something reviewed and added.

My SAP HANA Bookmarks

Basics of HANA


Hardware, H/W Configuration, Sizing and Pricing


SAP HANA Installation and Configuration Guides


Miscellaneous

Publications and presentations by Dr Bjarne Berg - Links to a lot of SAP Insider ppts. I found HANA 2014 A to Z Guide very useful. Did not go through all the ppts.

[Stay tuned, more to come...]

Oracle parameters and their descriptions

Here are some important Oracle parameters and information in the context of use with SAP applications.

BACKGROUND_DUMP_DEST
  • Path for alert log and background trace files

COMPATIBLE
  • Defines the Oracle version whose features can be used to the greatest extent
  • As a rule, it must not be reset to an earlier release (see Note SAP 598470).
  • A value with three parts (such as 10.2.0) rather than five parts (such as 10.2.0.2.0) is recommended to avoid changing the parameter as part of a patch set installation.
  • If an ORA-00201 error occurs when you try to convert the value with five parts 10.2.0.2.0 to 10.2.0, you can leave the value 10.2.0.2.0 (independent of the patch set used).

CONTROL_FILES
  • Path and name of the control files that are used

CONTROL_FILE_RECORD_KEEP_TIME
  • Defines how many days historic data is retained in the control files
  • Historic data is required by RMAN, for example.
  • May cause control files to increase in size (see Note 904490)

CORE_DUMP_DEST
  • Path under which core files are stored

DB_BLOCK_SIZE.
  • Size of an Oracle block
  • Can be set to a value higher than 8K in well-founded individual cases after it has been approved by SAP Support (see Note 105047)

DB_CACHE_SIZE
  • Size of the Oracle data buffer (in bytes)
  • Optimal size depends on the available memory (see Notes 789011 and 617416)

DB_FILES
  • Maximum number of Oracle data files

DB_NAME
  • Name of the database

DB_WRITER_PROCESSES
  • Number of DBWR processes

EVENT
  • Activation of internal control mechanisms and functions
  • To set events in SPFILE, refer also to Note 596423.
  • If many events are set, data sources such as V$PARAMETER, DBA_HIST_PARAMETER, or "SHOW PARAMETER" may supply an incomplete value. This is only a display problem. The values that are included in V$PARAMETER2 are the relevant values.

FILESYSTEMIO_OPTIONS
  • Activation of file system functions (see Note 999524 and Note 793113)
  • If you previously used a large file system cache (>= 2 * Oracle Buffer Pool), the performance may get worse after you activated the direct I/O if you set FILESYSTEMIO_OPTIONS to SETALL. Therefore, it is important that you enlarge the Oracle buffer pool to replace the file system cache that is no longer available.

HPUX_SCHED_NOAGE
  • Optimized scheduling policy for Oracle processes on HP-UX.
  • The privileges RTSCHED and RTPRIO must be assigned to the dba group to enable you to use the functions (see Note 1285599).

LOG_ARCHIVE_DEST
  • Historic variant of LOG_ARCHIVE_DEST_1, which is not compatible with features such as the Flash Recovery Area and which should therefore no longer be used.

LOG_ARCHIVE_DEST_1
  • Path/prefix for offline redo logs
  • The syntax differs with an additional "LOCATION=" string of LOG_ARCHIVE_DEST; if this difference is ignored, ORA-16024 occurs concerning LOG_ARCHIVE_DEST_1.

LOG_ARCHIVE_FORMAT
  • Name format of the offline redo logs
  • To avoid the problems described in Note 132551, it must be explicitly set to WINDOWS at least.

LOG_BUFFER
  • Minimum size of the Oracle redo buffer (in bytes)
  • Oracle internally determines the buffer's actual size, so it is normal for "SHOW PARAMETER LOG_BUFFER" or a SELECT on V$PARAMETER to return values between 1MB and 16MB.

LOG_CHECKPOINTS_TO_ALERT
  • Defines whether checkpoints are to be logged in the alert log

MAX_DUMP_FILE_SIZE
  • Maximum size of Oracle trace files (in operating system blocks)
  • A limitation is useful to avoid file system overflows and to reduce the duration of the dump generation.
  • You can increase it temporarily if required.


OPEN_CURSORS
  • Maximum number of cursors opened in parallel by one session

OPTIMIZER_DYNAMIC_SAMPLING
  • Determines how much data is to be read to determine the access plan.
  • Level 2 (the default setting for Oracle 10g): Dynamic sampling is performed only if tables do not have any statistics.
  • Level 6: As level 2 and includes dynamic sampling of 128 table blocks if literals are used and there are no bind variables.

OPTIMIZER_INDEX_COST_ADJ
  • Adjusts the calculated index costs; when there is a value of 20 (percent), index costs are reduced by a factor of 5, for example.
  • A value lower than 100 is advisable so that index accesses are preferred instead of full table scans.

PARALLEL_EXECUTION_MESSAGE_SIZE
  • Defines size of the memory area for parallel query messages (in bytes)

PARALLEL_MAX_SERVERS
  • Defines the maximum number of parallel execution processes (see Note 651060)
  • Based on the number of CPU Cores of the database server
  • The number of CPU Cores generally corresponds to the default value for the Oracle parameter CPU_COUNT. If you are unsure in individual cases, you can use the value of the parameter CPU_COUNT (for example, in transaction DB26).
  • If the database shares the server with other software (for example, SAP central instance, other Oracle instances), you can also select a lower value (for example, 8 CPU Cores, the SAP central instance and the Oracle database should share resources 50:50 -> PARALLEL_MAX_SERVERS = 8 * 0.5 * 10 = 40).

PARALLEL_THREADS_PER_CPU
  • Defines the number of parallel query processes that can be executed in parallel for each CPU
  • Influences the DEFAULT level of parallel processing during a parallel execution (see Note 651060).

PGA_AGGREGATE_TARGET
  • Checks the available PGA memory (see Notes 789011 and 619876)

PROCESSES
  • Defines the maximum number of Oracle processes that exist in parallel
  • The component relating to ABAP work processes is only relevant in systems with ABAP stacks. The component relating to J2EE server processes is only relevant in systems with Java stacks.
  • <max-connections> indicates the maximum number of connections (also called pool size) of the J2EE system DataSource (sysDS.maximumConnections). You can set the value of this parameter using the VisualAdmin tool or other J2EE administration tools.

QUERY_REWRITE_ENABLED
  • Defines whether query transformations are also factored in when the access path is determined

RECYCLEBIN
  • Enables access later on to objects that have already been dropped
  • Not supported by SAP (see Note 105047)

REMOTE_OS_AUTHENT
  • Defines whether TCP database access via OPS$ users is allowed (see Note 400241)

REPLICATION_DEPENDENCY_TRACKING
  • Defines whether the system has to create replication information when the database is accessed
  • Performance improves if it is deactivated

SESSIONS
  • Defines the maximum number of Oracle sessions that exist in parallel - must be configured larger than PROCESSES, since single processes can serve several sessions (for example, in the case of multiple database connections from work processes)

SHARED_POOL_SIZE
  • Defines the size of the Oracle shared pool (see Notes 690241 and 789011)

STAR_TRANSFORMATION_ENABLED
  • Specifies to what extent STAR transformations can be used

UNDO_MANAGEMENT
  • Defines whether automatic undo management is used (see Note 600141)

UNDO_TABLESPACE
  • Defines the undo tablespace to be used (see Note 600141)

USER_DUMP_DEST
  • Path for trace files of Oracle shadow processes

_B_TREE_BITMAP_PLANS
  • Defines whether data of a B*TREE index can be transformed into a bitmap display during a database access.

_BLOOM_FILTER_ENABLED
  • Determines whether bloom filters may be used during joins.

_DB_BLOCK_NUMA
  • Control use of NUMA optimizations.

_ENABLE_NUMA_OPTIMIZATION
  • Control use of NUMA optimizations.

_FIX_CONTROL
  • Activates or deactivates individual CBO fixes
  • To set _FIX_CONTROL, see Note 1455168.
  • If many _FIX_CONTROL values are set, data sources such as V$PARAMETER, DBA_HIST_PARAMETER, or "SHOW PARAMETER" may supply an incomplete value. This is only a display problem. The values that are included in V$SYSTEM_FIX_CONTROL are the relevant values.
  • Note 1454675 describes a problem whereby the _FIX_CONTROL values do not work despite being displayed correctly in V$PARAMETER.

_CURSOR_FEATURES_ENABLED
  • With a value of 10 and in connection with fix 6795880, the following is prevented: sporadic hanging during parsing

_FIRST_SPARE_PARAMETER
  • This is a generic parameter that can be used for different purposes in certain cases.
  • With Oracle 10.2.0.4 and fix 6904068, you use this parameter to introduce a break of 1/100 second between two "cursor: pin S" mutex requests instead of continually executing requests. This may help to avoid critical CPU bottlenecks.

_INDEX_JOIN_ENABLED
  • Controls whether index joins can be used or not; within an index join, two indices of a table are directly linked together.

_IN_MEMORY_UNDO
  • Controls whether the In Memory Undo feature (IMU) is used or not

_OPTIM_PEEK_USER_BINDS
  • Defines whether Oracle takes the contents of the bind variables into account during parsing
  • May cause various problems (Notes 755342, 723879) if not set to FALSE.

_OPTIMIZER_BETTER_INLIST_COSTING
  • Controls the cost calculation for IN lists
  • If the parameter is set to OFF, long IN lists are evaluated very favorably.
  • The CBO performs a reasonable cost calculation for IN lists using the value ALL.
  • Therefore, you should always use the default value ALL (this means that you should not set the parameter). If the CBO takes incorrect decisions in individual cases, these incorrect decisions must be analyzed and corrected.

_OPTIMIZER_MJC_ENABLED
  • Controls whether Cartesian merge joins are used.

_PUSH_JOIN_UNION_VIEW
  • Controls whether join predicates may be used in a UNION ALL construct beyond the view boundaries.

_SORT_ELIMINATION_COST_RATIO
  • Controls rule-based CBO decision in connection with the FIRST_ROWS hint and ORDER BY (see Note 176754).

_TABLE_LOOKUP_PREFETCH_SIZE
  • Controls whether table prefetching is used (a value of zero means no table prefetching).

Prevent Java installer and updater from offering bonus products

Java installer and updater offers bonus products like browser toolbars, that are mostly useless and annoying (unless you love those toolbars adorning half of your browser real estate). Not only does it offer you those products, but marks them for installation by default. These guys know you don't want it, and make it slightly tricky to uncheck them. You have to click exactly on the check box; usual UI should allow it even when you click on the adjacent text. But no, you have to click on the checkbox.

You have to remember to uncheck it during installation or every time you update to prevent those toolbars from being installed.

You can stop the installer or updater program from offering such products by selecting "Suppress sponsor offers..." option in their advanced setting.
  1. Go to Control Panel
  2. Go to Java (xx-bit)
  3. Go to the Advanced tab
  4. Scroll to the bottom of the list
  5. Add a checkmark to Suppress sponsor offers when installing or updating Java

Prevent Java installer and updater from offering bonus products

Alternatively you can install from ninite.com. They remove such useless "features" from many programs and save you the headache of doing it yourself.

Downloads folder in Windows loads slowly

The downloads folder is the default location for files downloaded from various folders (some browser let you choose one during download and allow them to use a separate folder). The downloads folder usually ends up being optimized for images and when you have other files, it tends to slow down the file listing as you open it.

One of the tricks is to change the settings of this folder to optimize it for a variety files and not just for pictures.

  1. Right click on the Downloads folder, select Properties and go to Customize tab.
  2. Select General Items from the drop down for Optimize the folder for.
  3. Click on Apply and OK to save the changes.


Downloads folder in Windows loads slowly


More posts on proper usage of Windows OS:
I changed Open with option of all the exe files. How to fix it?
Prevent DDoS attacks on Skype.
Get rid of animations and focus on task at hand.
Attaching a file to a jpg.


Email Subscription

Get every new post into your inbox by subscribing us.

Want a reason to subscribe?
1. This sitemap might convince you to subscribe.
2. We do not misuse email IDs. We respect privacy.

© 2015 sapnwnewbie. All rights reserved.