How To Convert Filenames To Lowercase On Unix

To make the conversion character we will use the tr (translate characters) Unix command.

Create a file with some characters uppercase;

touch MyLittleFile.LOG

Run the following command. It is a mv in which we say rename the old and new files with all lowercase characters;

mv MyLittleFile.LOG `echo MyLittleFile.LOG | tr [:upper:] [:lower:]`

And we get the following result;

mylittlefile.log

With this command we can also proceed backwards, go to uppercase. Run the following commands;

mv mylittlefile.log `echo mylittlefile.log | tr [:lower:] [:upper:]`

And get change the file name as stated below;

MYLITTLEFILE.LOG

HTH – Antonio NAVARRO

Advertisements

Install MySQL As A Service Fails

I am installing the latest version of MySQL, the 5.7 release. In windows you have the option to run MySQL as a service or application.I recommend install it as a service. When creating the installer service will give us two options;

i) use a Standard System Account
ii) use a Custom User

 
Like show in the next screenshot;

FOTO_13

I recommend, as a database administrator, and generally in all, SQL Server, Oracle … MySQL systems running like Custom User and have a domain account specified for this task.
The problem I have is that I get the following error;

“The user does not Have the minimum rights required to start the service”

In this case the system admin to solve this issue has granted the  “log on as service” permission to this specific account that I use for windows services.

HTH – Antonio NAVARRO

The Paste Unix Command

Today I had to process thousands of files containing two lines, the first with the start time of a process and the second line with the time of termination of the process. Of course, maybe it would be a single log file where all the records are in a file rather than per process, but the process is inherited and is designed to work in this way. The problem is that I need automating the management of this information and it is most useful if I have it in a single line, because I will take the hours of beginning and end. For this there are several tools, but today I speak of the paste command, which is usually quite unknown and can be very powerful to together text horizontally.

This is an example of my original file;

 
moon:/supro_downloads/logs=> cat Supro_00203.log
Time start: 160216:1236
Time end: 160216:1236

And this would be the result of doing a simple paste;

 
moon:/supro_downloads/logs=> paste -s Supro_00203.log
Time start: 160216:1236 Time end: 160216:1236

In my case I am carrying a general file and then automate their treatment;

 
moon:/supro_downloads/logs=> paste -s Supro_00203.log  >> All_Times.log

HTH – Antonio NAVARRO

ORAchk New Release 12.1.0.2.6

Oracle has announced a new version of this powerful tool which in many situations works like a a starting point, or baseline of the system. Giving recommendations and best practices for Oracle databases. Such tools are becoming more and morepopular among manufacturers database, in the Microsoft case, for SQL Server, there is available SQL Server Best Practices Analyzer. A point in favor of all providers that help make easier the day to day of many DBAs.

You can get more information and download the tool at the following link;

ORACHK 12.1.0.2.6

HTH – Antonio NAVARRO

How To Assigning An IP To An ACL

In this example we will assign a new ip/web address to an ACL that already exists. First of all let’s see what’s on the list, for this run the following query;

PAYP*ANTO> COLUMN ACL FORMAT A50
PAYP*ANTO> COLUMN HOST FORMAT A50
PAYP*ANTO> SELECT ACL, HOST, LOWER_PORT, UPPER_PORT FROM DBA_NETWORK_ACLS;

ACL                                          HOST                                               LOWER_PORT UPPER_PORT
____________________________________________ __________________________________________________ __________ __________
/sys/acls/visa_acl.xml                       10.300.202.25                                      ø          ø
/sys/acls/visa_acl.xml                       10.300.202.46                                      ø          ø
/sys/acls/visa_acl.xml                       10.300.202.47                                      ø          ø
/sys/acls/visa_acl.xml                       10.300.202.81                                      ø          ø

4 filas seleccionadas.

In this case it returned four directions. Now let’s allow the ip 10.300.202.95, for it we’ll use DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL package as shown in the following example;

BEGIN
  DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL (
    acl         => 'visa_acl.xml',
    host        => '10.300.202.95',
    lower_port  => NULL,
    upper_port  => NULL);

  COMMIT;
END;
/

There is no restriction on ports, so we set lower_port and upper_port to null. Rerun the query from above;

PAYP*ANTO> SELECT ACL, HOST, LOWER_PORT, UPPER_PORT FROM DBA_NETWORK_ACLS;

ACL                                          HOST                                               LOWER_PORT UPPER_PORT
____________________________________________ __________________________________________________ __________ __________
/sys/acls/visa_acl.xml                       10.300.202.95                                      ø          ø
/sys/acls/visa_acl.xml                       10.300.202.25                                      ø          ø
/sys/acls/visa_acl.xml                       10.300.202.46                                      ø          ø
/sys/acls/visa_acl.xml                       10.300.202.47                                      ø          ø
/sys/acls/visa_acl.xml                       10.300.202.81                                      ø          ø

5 filas seleccionadas.

 

For delete an ACL entry you must use the DBMS_NETWORK_ACL_ADMIN package with UNASSIGN_ACL procedure, like show below;

BEGIN
  DBMS_NETWORK_ACL_ADMIN.UNASSIGN_ACL(acl => 'visa_acl.xml',host => '10.300.230.31');
END;
/
COMMIT;

HTH – Antonio NAVARRO

Enable Trace In SQL Server To View The Deadlock

Today I have been reported a problem in a SQLServer database, a process has failed, of course, it dead returning a deadlock error. The first problem I’ve found is that the trace was not activated to keep the record of what happened to a greater level of detail. Generally is good save or register such errors. Based in my experience in the 90% of cases is problem of designing the application. Normally speaking with people development and passing the information captured in the trace is more than enough to solve it.

To activate the trace and generate the trace when the problem occurs we execute the following code, remember that it is global, you can not activate a session level;

 

-- All together ----
DBCC TRACEON (1204, 1222)
GO

-- Other way is one to one ----
DBCC TRACEON (1204)
GO
DBCC TRACEON (1222)
GO

This will make write the system log.
HTH – Antonio NAVARRO