Error handling and application logging are the most import tasks associated with programming that are over looked by many developers. After a program is released to the field, how do you know if it is performing as it should? Are there issues with the language execution (1-tier), with the database (2-tier) or with the middle-ware (3-tier) ? Many times, issues are only noticed and acted upon after several complaints have been issued. Here is a short list of why you should adding logging to all programs that you create. Traps…
Running the SMTP Relay
Today, I want to talk about sending email using SMTP relay host. The topic of a SMTP relay is an mportant one that you will come across in your career. A open mail relay allows a PERL script to send mail messages from a mail box that you can name and does not have to exist on the mail server. In todays information world, it is very important to stay connected via emails. Emails can be used for many different purposes in your PERL scripts. Alerting when system thresholds or…
Text Files
The first type of file that every programmer writes to and reads from is an ASCII text file. A text file is a kind of computer file that is structured as a sequence of lines. Each line is terminated with a special character such as a line feed (LF) in UNIX or a carriage return (CR) and line feed (LF) in MS DOS. One special type of text file is called a Comma Seperated Value (CSV) file. CSV is a delimited data format that has fields/columns separated by the comma…
Why use PERL?
PERL was originally written by Larry Wall while he was working at NASA’s jet prepulsion laboratories. It’s syntax is a combination of many different languages. While PERL is not a acryonymn, one of Larry’s favorites is ‘Pratical Extraction and Reporting Language’. The first version of PERL was release in December, 1987. Getting to the main question, ‘Why use PERL?’. Here are a few reasons why people use the language. It’s free! The PERL language can be installed on any UNIX box for free. The community version of Active State Perl…
Various Triggers – Part 6
Triggers can be used to track Data Manipulation Language (DML) changes that occur in tables. Today, I am going to expand the AUTOS database script to add table auditing. Auditing is a very good practice when multiple people have rights to make changes to important semi-static data. This is not a good solution if the amount of data is large or number of table changes are huge. First, I am going to leverage the newly built schema called Audit Database Tracking (ADT) to seperate data tables from audit tables. A…
Upgrading Older Databases
A new version of SQL Server is released every few years. This year was no different with the launch of SQL Server 2012 in March. It is important to migrate older, unsupported databases to a current version. I am going to examine 3 different techniques to upgrade the [PUBS] sample database from SQL Server 2000 to 2008 R2. The first two techniques require the database files to be copied from the older server to the new one. Use the ALTER DATABASE command to kick off the users and set the…
Various Triggers – Part 5
Another usage of Database Triggers is track Data Definition Language (DDL) changes that occur in a database. Today, I am going to enhance the AUTOS database script to add such auditing. This auditing is a very good practice when multiple people have syadmin rights to make such changes. First, I am going to create a schema called Audit Database Tracking (ADT) to seperate the data tables from audit tracking tables.
1 2 3 4 5 6 7 8 9 |
<span style="color: #008000; font-size:small;">-- Delete existing schema. IF EXISTS (SELECT * FROM sys.schemas WHERE name = N'ADT') DROP SCHEMA [ADT]; GO -- Create a ADT schema CREATE SCHEMA [ADT] AUTHORIZATION dbo; GO </span> |
Second, I am going to create a table to hold the keep track of the DDL changes that are…
Protecting the [sa] Account
During the installation of SQL Server, you are prompted to select an authentication mode. Regardless of the choice, a [sa] account will be created. If you are using Windows Authentication, the account will be be left in a disabled state. On the other hand, if you are using Mixed Mode Authentication, you are asked for a password and the [sa] account will be left in an enabled state. Because the sa account is well known and often targeted by malicious users, do not enable the [sa] account unless your application…
Various Triggers – Part 4
Another usage of Data Modification Language (DML) triggers is the replicating data for historical tracking or data aggregation. Today, I am going to expand on the AUTOS database that I created in prior articles to demonstrate such usage. The business unit has asked us to track each macro task in the making of an automobile. To accomplish this goal, I am going to add the following objects to the AUTOS database. STATUS_CODE – a coded version of the status of a given task. MAKE_STATUS – for a given vehicle…
Just Say No!
Most security administrators are eager beavers when it comes to deploying and running antivirus software on any computer they can get their hands on. This includes Microsoft Windows Servers running your SQL Server Database engine. Do not let security administrators scan your database files and make your 2012 Dell xeon with eight cores perform like a 1996 Gateway Pentium 4 single core. I have seen the results of antivirus software scanning the database files while I am trying to execute basic queries. It is extremely painful. With that said.…