Windows (powershell) counterparts of Linux commands

January 21, 2019 Leave a comment

You may find Windows mostly powershell equivalent of frequently used Linux commands here.

I will update this post, with newer ones by the time…

tail -100f <file mask>

Via powershell, without installing new software, you may issue below command for refreshing the alert log and seeing last 100 rows displayed in the very beginning.

Get-Content alertmydb.log -Wait -tail 100

2019-01-21_13-33-24

history

For history of commands executed simply issue.

Get-History

2019-01-21_12-49-35

grep

select-string <string to look for> <file name>

2019-01-21_12-40-38

find

Find the files having a mask alert*log up to 5 directories depth.

gci -Path alert*log -Recurse -Depth 5

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-childitem?view=powershell-6

2019-01-21_13-47-03

 

Categories: Uncategorized

Resizing online redo log

January 17, 2019 Leave a comment

It seems an easy topic, I prefer being careful with the easy ones… so it is handy to have all you need, in one place and which will lead implementing things faster and safer.

So, here, You will find how to resize redolog files statements; exact building blocks, ie adding redo log files, grouping/mirroring them more than one disk location, specifying the file names with ASM auto generated way, making status inactive for dropping, dropping old ones, switching between log files, all in one place!

Resizing means, you need to create or add new redo log files with a desired size and drop the old ones. For example in this example I had 3 files having 50MBs, I had created 500MB redo log files first. And dropped the old 50MB ones, this way resized the redo files.

Recall that you should check for the space in disk group in ASM first, to create bigger or additional redo log group. For example I saw, 8519 and 8517 MB free for my diskgroups REDOLOGS and REDOLOGS1, so no problem to create additioal 3 redolog files having total of 1500MB files.

SQL> select name, state, free_mb from v$asm_diskgroup;

NAME                           STATE          FREE_MB
------------------------------ ----------- ----------
REDOLOGS                       CONNECTED         8519
REDOLOGS1                      CONNECTED         8517
DATA                           CONNECTED        87717
ARCHIVELOGS                    CONNECTED        40274

SQL>

Also, note the current redo log file sizes first below:

-- redolog files info
SELECT b.thread#, a.group#, a.member, b.bytes FROM v$logfile a, v$log b WHERE a.group# = b.group#;
THREAD# GROUP# MEMBER BYTES
---------- ---------- ---------------------------------------------------------------------------------------------------- ----------
1 1 +REDOLOGS/IDRA/ONLINELOG/group_1.278.997880185 52428800
1 1 +REDOLOGS1/IDRA/ONLINELOG/group_1.289.998810187 52428800
1 2 +REDOLOGS/IDRA/ONLINELOG/group_2.297.998810193 52428800
1 2 +REDOLOGS1/IDRA/ONLINELOG/group_2.298.998810201 52428800
1 3 +REDOLOGS/IDRA/ONLINELOG/group_3.281.998810211 52428800
1 3 +REDOLOGS1/IDRA/ONLINELOG/group_3.280.998810219 52428800

Adding redolog file statement is fairly self descriptive. You may mirror the files to different disk groups as giving them in (‘(ONLINELOG)’,'(ONLINELOG)’) Here the ONLINELOG is the template used for creating the auto generated names. I am using new GROUP numbers 4,5,6, which will not overlap existing group numbers 1,2,3. If you use existing ones you will get ORA-01184 error as shown below. In RAC, in which multiple instance (THREAD) in place you will create additional redolog groups for each instance or thread.

--adding redolog file with mirroring to +REDOLOGS asm diskgroup, giving sizing as 500 MB.

ALTER DATABASE ADD LOGFILE THREAD 1 
GROUP 4 ('+REDOLOGS(ONLINELOG)','+REDOLOGS1(ONLINELOG)') size 500M REUSE, 
GROUP 5 ('+REDOLOGS(ONLINELOG)','+REDOLOGS1(ONLINELOG)') size 500M REUSE, 
GROUP 6 ('+REDOLOGS(ONLINELOG)', '+REDOLOGS1(ONLINELOG)') size 500M REUSE;
SQL> ALTER DATABASE ADD LOGFILE GROUP 3 ( '+REDOLOGS1(ONLINELOG)') SIZE 500M REUSE;
ALTER DATABASE ADD LOGFILE GROUP 3 ( '+REDOLOGS1(ONLINELOG)') SIZE 500M REUSE
*
ERROR at line 1:
ORA-01184: logfile group 4 already exists

So, we finished with adding new redo log groups. New added ones are in status UNUSED

-- for status of log files
SQL> SELECT group#, status from v$log;

GROUP# STATUS
---------- ----------------
1 INACTIVE
2 INACTIVE
3 CURRENT
4 UNUSED
5 UNUSED
6 UNUSED

It is straightforward to drop a log file, if it is in INACTIVE mode. In case it is in use having ACTIVE or CURRENT statuses, and you want to drop it, you will probably get following error:

-- for deleting/dropping old log files
ALTER DATABASE DROP LOGFILE GROUP 1;
SQL> ALTER DATABASE DROP LOGFILE GROUP 1;
ALTER DATABASE DROP LOGFILE GROUP 1
*
ERROR at line 1:
ORA-01624: log 1 needed for crash recovery of instance idra (thread 1)
ORA-00312: online log 1 thread 1: '+REDOLOGS/IDRA/ONLINELOG/group_1.257.907425247'
ORA-00312: online log 1 thread 1: '+REDOLOGS1/IDRA/ONLINELOG/group_1.258.907425247'

In case, the log status is CURRENT, like above, for GROUP 3 and you want to drop it. Then you should switch to next group by below statement:

-- for switching among groups
alter system switch logfile;

Even you made switches to further groups, it does not mean that it will change the status to INACTIVE, for making ACTIVE to INACTIVE, a CHECKPOINT should be  in place, which does not switch log files but writes changes to datafiles, in which you will not need REDO for recovery which are not CURRENT.

-- for making active to inactive
alter system checkpoint;

 

Categories: Uncategorized

MS SQL Server Backup File Size Requirement

January 2, 2019 Leave a comment

In SQLServer 2012, using below backup command, I started taking a backup and  it first created a 130G BAK file. I was expecting around 60G file and my disk space was around 150G. Because of that I started monitoring, the only information I have was it will be a compressed file, and the current percentage of completion.  Fortunately, it finished with 60G file when it was 100 percent.

0201

:Setvar DB MYDB
:Setvar date 20190102

BACKUP DATABASE [$(DB)] TO DISK = N’C:\SQLBCK\$(DB)_prod_$(date).bak’ WITH NOFORMAT, INIT, NAME = N’$(DB) prod-Full Database Backup $(date)’, SKIP, NOREWIND, NOUNLOAD, COMPRESSION, STATS = 10
GO

In the support note it says creating a file with an estimated file size is for performance benefit. “This size is calculated directly from the number of allocated extents in the data files that are specified for the backup. ” Not surprisingly, instead of incrementally allocating disk space, it first creates a target estimate size file, and fills it, and releases unused space at the end.

https://support.microsoft.com/en-us/help/2001026/inf-space-requirements-for-backup-devices-in-sql-server

So, for less space environments, is there a way of opting out performance?

The answer is yes. Not to allocate a big target space, you may enable trace flag 3042 for incremental sizing. For details please look into below article. https://www.mssqltips.com/sqlservertip/2531/sql-server-compressed-backups-disk-space-needs/

Lessons learnt from this experience is just be cautious about the disk space in bigger size databases. It will not be greater than the database.

dba_locks does not show for both instances

October 25, 2017 Leave a comment

Problem: While working on blocking session script below, I figured out that blocking sessions are not displayed in both nodes of the rac, exadata.

SELECT
 decode (s2.sid,s1.FINAL_BLOCKING_SESSION,'*'||s2.sid,' '||s2.sid) Blocker_SID
 ,s2.serial# blocker_serial
 ,s2.inst_id blocker_inst_id
 ,s2.con_id Blocker_con_id
 ,s2.status Blocker_Status
 ,s2.username Blocker_User
 ,s2.osuser Blocker_OS_User
 ,s2.process Blocker_OS_PID
 ,s2.sql_id Blocked_sql_id
 ,o.owner Object_owner
 ,o.object_name Locked_Object
 ,o.object_type Locked_Object_Type
 ,l2.lock_type Blocking_Lock_Type
 ,substr(s2.program,1,10) Blocker_Program
 ,s2.client_info Blocker_Client
 ,s1.sid blocked_sid
 ,s1.inst_id blocked_inst_id
 ,s1.con_id Blocker_con_id
 ,s1.status Blocked_Status
 ,s1.username Blocked_User
 ,s1.osuser Blocked_OS_User
 ,s1.process Blocked_OS_PID
 ,s1.sql_id Blocked_sql_id
 ,s1.last_call_et Blocked_Age
 ,substr(s1.program,1,10) Blocked_Program
 ,s1.client_info Blocked_Client
 FROM gv$session s2
 join gv$session s1 ON (s1.blocking_session=s2.sid)
 join dba_objects o on (o.object_id=s1.ROW_WAIT_OBJ#)
 join dba_locks l2 on (s2.sid=l2.session_id)
 left join dba_locks l1 on (s1.sid=l1.session_id and l1.lock_type = l2.lock_type AND l1.lock_id1 = l2.lock_id1 AND l1.lock_id2 = l2.lock_id2)
 where s1.last_call_et>10 and upper(l2.MODE_HELD)='EXCLUSIVE';

Cause: Usual suspect in the from clause are dba_objects, gv$session, and dba_locks. I just look into the dba_locks, because dba_objects is just related with database physical structure which should be common in RAC. gv$session also cannot be, because it is gv$, it must surely include common information among instances again. So, it must be for dba_locks, and there it is,

desc DBA_LOCKS
SESSION_ID NUMBER
LOCK_TYPE VARCHAR2(26)
MODE_HELD VARCHAR2(40)
MODE_REQUESTED VARCHAR2(40)
LOCK_ID1 VARCHAR2(40)
LOCK_ID2 VARCHAR2(40)
LAST_CONVERT NUMBER
BLOCKING_OTHERS VARCHAR2(40)

Solution:

There must be alternative real RAC aware version of it. It is GV$LOCK, some small differences in column names, and values, it has same information, and it shows more for both nodes.

desc GV$LOCK
INST_ID NUMBER
ADDR RAW(8)
KADDR RAW(8)
SID NUMBER
TYPE VARCHAR2(2)
ID1 NUMBER
ID2 NUMBER
LMODE NUMBER
REQUEST NUMBER
CTIME NUMBER
BLOCK NUMBER
CON_ID

Before my script looks like this:

SELECT
 decode (s2.sid,s1.FINAL_BLOCKING_SESSION,'*'||s2.sid,' '||s2.sid) Blocker_SID
 ,s2.serial# blocker_serial
 ,s2.inst_id blocker_inst_id
 ,s2.con_id Blocker_con_id
 ,s2.status Blocker_Status
 ,s2.username Blocker_User
 ,s2.osuser Blocker_OS_User
 ,s2.process Blocker_OS_PID
 ,s2.sql_id Blocked_sql_id
 ,o.owner Object_owner
 ,o.object_name Locked_Object
 ,o.object_type Locked_Object_Type
 ,l2.lock_type Blocking_Lock_Type
 ,substr(s2.program,1,10) Blocker_Program
 ,s2.client_info Blocker_Client
 ,s1.sid blocked_sid
 ,s1.inst_id blocked_inst_id
 ,s1.con_id Blocker_con_id
 ,s1.status Blocked_Status
 ,s1.username Blocked_User
 ,s1.osuser Blocked_OS_User
 ,s1.process Blocked_OS_PID
 ,s1.sql_id Blocked_sql_id
 ,s1.last_call_et Blocked_Age
 ,substr(s1.program,1,10) Blocked_Program
 ,s1.client_info Blocked_Client
 FROM gv$session s2
 join gv$session s1 ON (s1.blocking_session=s2.sid)
 join dba_objects o on (o.object_id=s1.ROW_WAIT_OBJ#)
 join dba_locks l2 on (s2.sid=l2.session_id)
 left join dba_locks l1 on (s1.sid=l1.session_id and l1.lock_type = l2.lock_type AND l1.lock_id1 = l2.lock_id1 AND l1.lock_id2 = l2.lock_id2)
 where s1.last_call_et>10 and upper(l2.MODE_HELD)='EXCLUSIVE';

After making modifications on column names and, associated values, my script turns out to be as follows:

SELECT
 decode (s2.sid,s1.FINAL_BLOCKING_SESSION,'*'||s2.sid,' '||s2.sid) Blocker_SID
 ,s2.serial# blocker_serial
 ,s2.inst_id blocker_inst_id
 ,s2.con_id Blocker_con_id
 ,s2.status Blocker_Status
 ,s2.username Blocker_User
 ,s2.osuser Blocker_OS_User
 ,s2.process Blocker_OS_PID
 ,s2.sql_id Blocked_sql_id
 ,o.owner Object_owner
 ,o.object_name Locked_Object
 ,o.object_type Locked_Object_Type
 ,l2.type Blocking_Lock_Type
 ,substr(s2.program,1,10) Blocker_Program
 ,s2.client_info Blocker_Client
 ,s1.sid blocked_sid
 ,s1.inst_id blocked_inst_id
 ,s1.con_id Blocker_con_id
 ,s1.status Blocked_Status
 ,s1.username Blocked_User
 ,s1.osuser Blocked_OS_User
 ,s1.process Blocked_OS_PID
 ,s1.sql_id Blocked_sql_id
 ,s1.last_call_et Blocked_Age
 ,substr(s1.program,1,10) Blocked_Program
 ,s1.client_info Blocked_Client
 FROM gv$session s2
 join gv$session s1 ON (s1.blocking_session=s2.sid)
 join dba_objects o on (o.object_id=s1.ROW_WAIT_OBJ#)
 join gv$lock l2 on (s2.sid=l2.sid)
 left join gv$lock l1 on (s1.sid=l1.sid and l1.type = l2.type AND l1.id1 = l2.id1 AND l1.id2 = l2.id2)
 where s1.last_call_et>10 and l2.LMODE=6;

 

 

Project Managers Fundamentals

December 13, 2015 Leave a comment

If a Project Manager is serving something to his/her customers around; it is pretty certain that he/she must have certain fundamentals. All you may have familiar with Scope, Cost, Time triplet which leads performance or quality of a project or a product coming out as a result of project development process. But, it is not fair to tell something about fundamentals of a project manager, which may cause an epic failure in his/her management career. Fundamental is a known thing. It is like a footballer cannot stop the ball well enough, or an HR specialist who does not listen people in his account, or a senior manager who makes micro management and loosing focus. So, I want to make a list of qualities, a project manager must have:

Organizing Meetings: Agenda, Locations, Time, Attenders, Type of Attendance are key aspects of meetings. You must share an open agenda beforehand. By “open” I mean update-able/correctable list of things in the agenda. Place must be stated before, which means you need to make reservations beforehand. It is hard to check in rooms in last days in many organizations, you must find a way of overcoming this issue, for example making reservations one or two weeks before, despite you have not got any meeting ahead. You can give away your room reservation if you do not need to use it. For multi-location meetings you need agents or friends in other locations for finding rooms. Starting time of meeting is very important, you must be aware of organizational culture. Try to start on time, and if you have doubts about the attendance, send last minute updates like “We are starting our meeting…” Also, you can call the key attenders in advance, in order to be sure about their time of attendance. Even, using sponsor power for attendance can be needed for tough attenders. Recent years come with alternative technologies for attending meetings like phone call, video conference, lync, etc. Choosing the type of attendance needs more attention. Let’s have a look to these types…

An astute project manager must choose best way of attendance type. If a project manager is trying to meet 3 people with a call conference, it could be understandable. But, if you try this for 10 people, you need to worry about what you are doing. Do not tell me that, technology allows this, and it is an option. You must think of using videoconferencing, or dividing the attenders and agenda, according to focus areas of people. It is also a common mistake that adding people to teleconference is not one-way thing. I mean as a project manager you are calling someone, after figuring out that he is busy and you are eventually passing to another attender, and because your line is busy at that time the first called person may not attend to conference because you are not aware of incoming call. Can it be? Sure… If your phone is not showing incoming calls while your telephone is busy. In Turkish there is a saying in this situation, “Get well soon!”. So, you must take care of your attenders. Small things can cause big things, you must think in details.

 

Applying Correct Communication
Types: A wise project manager must
choose best way of communication. If you
adaptable to or aware of culture and technology, you are lucky. Company/country culture may play a great role for choosing the best way of communication. As everyone suggests use emails for making commitments or distributing the agreed topics in meetings. Use emails if you are certain that you really need it. Call your colleagues, why bother them to understand your email that you write in 20 mins, and needs another 20 mins for replying. In most of the cases talking solves the problems. Being native with other members of project team does not mean you are in same working culture. You may miss the opportunity of clues of success which may only possible via effective way of communication. A tea or coffee may solve your problems which may worth million dollars.

Escalation Skills: I have cases that people who are reporting to me, have escalations, in which they do not do everything and want to escalate this immature thing. I just say, do you want me to do your work.

Please, investigate your escalation need, if you are escalating a situation that you do not think or work on it, it will be inevitable that you will be assessed with your perception and skills.If not, in this case assessors skills must me assessed:) Escalation goal is also important. Why do you escalate, for punishing someone. Definitely no! Do you know that escalation can also be a way presenting or showing someone’s or team’s work or risk taking. By escalating or highlighting an issue you are playing a great role if you think like that. For example, we had a case with operation team that, they did not want to open a feature in an equipment, which may lead saturation  problems in the future. What did they tell me? Escalate this, in order to make them understandable by marketing guys. We could make it, you are causing something that you do not wan to be. What happened, we did not open that feature and marketing guys ware persuaded for more expenditures/investment for the product.

Being positive: Be positive about people! If there is human there may be errors and malfunctions. Appreciate for success, appreciate for five nines availability. Do not stuck on 0,001 failure… When is the last time you had thanked someone about his/her work. You will win if you could understand people… You cannot get something from a person, or make efficient communication; if you do not know about him/her. Look, listen, and try to be positive in order to be perceptive.

You must continually sharpen your fundamentals. Remember a common saying:  “If it doesn’t kill you it makes you stronger!”

Categories: Uncategorized

If a project’s scope changes, it gets longer; if a project gets longer, scope changes!

December 15, 2014 Leave a comment

In our projects, we had figured out, the pattern in the title, that most of people probably had experienced. Due to some reason, if a project scope is changed, it will eventually means it will last longer than planned.

Tricky issue here is: it will not end with a time cost headache only. Because projects may fall into scope change if it gets longer than planned. In other words, go to market needs force scope change in longer times, because market is not static. So, what can be done, in order not to fall this circular loop of this quality problem. To avoid this mentioned risk; projects may be planned in phases or in small projects which have business deliverable in each small units.

The agile development techniques are awesome and successful, because they are smaller in size.

There is no way for huge size projects in business. So, divide and conquer! Close the project as soon as possible if you can, divide into phases if you can.

Oracle RAC 11.2.0.3 PSU4 Installation Notes

June 20, 2013 Leave a comment

Last month we had installed Oracle RAC 11.2.0.3 PSU4 to Red Hat 6.4 (Santiago).

You could find below documentation in PDF format for each part of installation:

There you can find cases, may be specific to our environment.  In order not to re-install several times, clean OS side etc., I had preferred, first ensuring our OS and network environment is ready for installation by using Oracle cluster verification utility.

This environment is in production and working for more than 2 weeks.

Hope this helps to anyone installing Oracle RAC 🙂

How to use Turkcell VINN modem in Ubuntu?

March 30, 2013 Leave a comment

Folowing link summarizes how to use VINN Modem, Turkcell brand, 3G USB modem in Linux. It is in Turkish but, screenshot helps a lot…

In summary, you must click Network Connections icon in System Tray and then choose New Mobile Broadband (GSM) connection. Follow the self explanatory steps and do not forget to use APNs like internet, or mgb as APN entry.

http://forum.shiftdelete.net/linux/116520-%5Bresimli-anlatim%5D-ubuntuda-turkcell-3g-vinn-usb-modem-ile-internete-baglanmak.html

Categories: links Tags: , , ,

SP2-0575: Use of Oracle SQL feature not in SQL92 Entry Level error

March 28, 2013 Leave a comment

I had encountered “SP2-0575: Use of Oracle SQL feature not in SQL92 Entry Level” error message.

When:

After my session is killed. And issued “set autotrace traceonly” as below:

ERROR at line 8:
ORA-00028: your session has been killed
ORA-00028: your session has been killed
17:38:53 TUNED>set autotrace traceonly
SP2-0575: Use of Oracle SQL feature not in SQL92 Entry Level.
17:39:07 TUNED>set autotrace trace only
SP2-0575: Use of Oracle SQL feature not in SQL92 Entry Level.
17:39:10 TUNED>
17:39:11 TUNED>
17:39:11 TUNED>
17:39:11 TUNED>conn Admin1@mydb1
Enter password:
Connected.
Elapsed: 00:00:00.01
17:39:29 ADMIN1@MYDB:mydb1> set autotrace traceonly
17:39:32 ADMIN1@MYDB:mydb1>

 

expdp with sys without knowing password

February 19, 2013 8 comments

Simple but very handy way of taking exports without knowing database password.

expdp \’/ as sysdba\’ DIRECTORY=DATA_PUMP_DIR DUMPFILE=example.dmp LOGFILE=example.log SCHEMAS=MYSCHEMA

Categories: tips Tags: , ,
Julian Dontcheff's Database Blog

Distinguished Product Manager - PL/SQL and JSON at Oracle

Bobby Durrett's DBA Blog

Oracle database performance

flashdba

Database Performance in the Cloud

Don Charisma

because anything is possible with Charisma

Carol no Mundo!

Aventuras de uma intercambista a trabalho pelo mundo!

nimaidba

Welcome to the world of Oracle with me....

Tech

News and reviews from the world of gadgets, gear, apps and the web

WordPress.com

WordPress.com is the best place for your personal blog or business site.

Gurcan Orhan's ODI and DWH Blog

Some words about Oracle Data Integrator and Data Warehousing.