Monday 25 January 2016

Renaming Data Files

We had an issue recently were someone's fat fingers (not guilty, honest) had accidently created a data file with an extension of .bdf as opposed to .dbf.

/u03/oradata/PRD/datafile/my_data_file.004.bdf

This is not really an issue - as far as the DB is concerned the database engine does not really care about the extension.
However in this instance the incorrectly named file was slipping past the “Database Exclude” filter in the sys admins file system backup utility.

Now Oracle 12c includes the ALTER DATABASE MOVE DATAFILE command, which performs an online move of a datafile.

ALTER DATABASE MOVE DATAFILE '/u01/app/oracle/oradata/cdb1/system01.dbf' TO '/tmp/system01.dbf';

Unfortunately this was 11g.

There are two ways to re-name a datafile, however both methods will require some downtime.

Method 1. - Take the associated tablespace offline and then rename the datafile.

This requires an outage to rename the datafile as we have to take tablespace offline to rename it.

 -- Take Table Space off-line
ALTER TABLESPACE PRD_PRIMARY_DATA OFFLINE NORMAL;

-- Rename Data File
ALTER TABLESPACE MY_DATA
RENAME DATAFILE '/u03/oradata/PRD/datafile/my_data_file.004.bdf'
TO '/u03/oradata/PRD/datafile/my_data_file.004.dbf';

-- Put Data File back on-line
ALTER TABLESPACE MY_DATA ONLINE;

Method 2. - Shutdown database and rename datafile

This could also be performed by taking the shuting down the database

Rename datafile by taking down the database.
sqlplus / as sysdba

SQL> SHUTDOWN IMMEDIATE
SQL> HOST mv /u03/oradata/PRD/datafile/my_data_file.004.bdf /u03/oradata/PRD/datafile/my_data_file.004.dbf

SQL> STARTUP MOUNT
SQL> ALTER DATABASE RENAME FILE '/u03/oradata/PRD/datafile/my_data_file.004.bdf' TO '/u03/oradata/PRD/datafile/my_data_file.004.dbf';

SQL> ALTER DATABASE OPEN;



Monday 18 January 2016

Install R in Fedora 23


R is a programming language and software environment for statistical computing and graphics. It is widely used among statisticians and data miners and seems to be ever growing in popularity.
R is also going to be incorporated into SQL Server 2016.

This is a short post which details how to install R and the R studio IDE in Fedora 23.

The R package is in the fedora repo (R-3.2.2-1.fc23.x86_64).

To install type -

sudo dnf install R

When I tried this I got the following error.
Last metadata expiration check performed 0:02:49 ago on Sat Jan  9 14:41:14 2016.
Error: package R-3.2.2-1.fc23.x86_64 requires R-devel = 3.2.2-1.fc23, but none of the providers can be installed

This was easily resolved by running the distro sync command. This command synchronize packages to the current repositories.

sudo dnf distro-sync

sudo dnf install R

RStudio IDE is a powerful and productive user interface for R. It’s free and open source, and is available for Windows, Mac, and Linux.
The latest version can be download straight from the R Studio website.

sudo dnf install https://download1.rstudio.org/rstudio-0.99.491-x86_64.rpm


Now you have successfully installed it, you can get started via the great tutorial from code school.

Sunday 10 January 2016

Technology Podcasts

 Tech Podcasts


I enjoy listening to Tech podcast's when I have to complete some of the less glamorous work that DBA's have to do to keep the lights on.
I have put together a list, which I will share below, of some of some of the shows I tend to listen to when I get the chance.
They are all Tech based and cover a wide range of topics from software engineering to Open Source software, Security, Politics and related subjects.

Bad Voltage is a fortnightly podcast in which the hosts talk about anything and everything from Technology, Open Source, Politics, and Music, complete with reviews and interviews.

A weekly talk show which takes a pragmatic look at the art and business of Software Development and related technologies.

FLOSS is a weekly show, from the TWIT network, about all things Free Libre Open Source Software.

Linux Voice is an independent GNU/Linux and Free Software magazine which was initially funded by a hugely successful crowd funding campaign.
The podcast is created by the magazine's journalist and released fortnightly.

PaulDotCom Security - http://securityweekly.com/
The latest information on security news, research, hacker techniques, vulnerabilities, and technical how-tos!

A weekly podcast staring Steve Gibson and Tech TV's Leo Laporte.
They spend something shy of two hours each week discussing important issues around personal computer security.

Software Engineering Radio - http://www.se-radio.net/
Software Engineering Radio is a podcast targeted at the professional software developer. It is released every 2 to 4 weeks and covers all software engineering topics.

Tech Dirt offers a unique insight into current news stories about changes in government policy, technology and legal issues that affect companies' ability to innovate and grow.

This Developer's Life - http://thisdeveloperslife.com/
A very well produced podcast about developers and their lives.

A further offering from the TWIT network. This involves a number of tech pundits in a roundtable discussion of the latest trends in technology.

Feel free to list your own favorites in the comments below.

Sunday 3 January 2016

DBA resolutions

New Year's resolution's for a DBA


According to wikipedia, "A New Year's resolution is a tradition, most common in the Western Hemisphere but also found in the Eastern Hemisphere,
in which a person makes a promise to do an act of self-improvement...."

I’m not a particular resolutions making kind of person - I don’t think you have to wait until a new year begins to resolve to do something meaningful, but I though it would be interesting to look at some specifically aimed at DBA's.
These are based on the subjects I have touched on in previous blogs, as well as interesting articles I have read during the year (they are a mixture of personal and work goals).
  • Stay curious and open to new opportunities. DBA's are expected to know everything about everything. Enjoy Technology.
  • Embrace Change - change is inevitable. Roll with the punches, stay positive and do the best with what is given to you. 
  • Maintain a Professional approach - it basically boils down to showing respect for others. 
  • Accept Responsibility - if you mess up, fess up.
  • Be realistic in terms of expectations. Things will not always work out as planned.  Every job has its good and bad points. Don't become the office whiner.
  • Continue teaching developers how to work with databases. This is a win / win as the result will be better code which works with the database instead of against it.   
  • Try and attend tech related events / conferences during the year. They are great ways to learn and also can help build your network.
  • Learn at least one new skill during 2016. Be it a new language, a new technology or perhaps work towards a certification. Don't worry about the state of the economy, concentrate on learning new skills. If the worst happens and you get laid off, the time you invested in improving your skills will make finding a new position much easier.
  • Avoid Office Politics - try not to be drawn into the games of office politics. This is a no win situation and the only outcome will be to create enemies and cause unnecessary division.
  • Work on Communication Skills - the most valuable skill that someone in technology can have is the ability to communicate with others. It does not matter which area of IT you are in - it is so important that you are able to clearly express what you want, need, or expect.
  • Build your Online Brand - create a website or contribute to forums and newsgroups. Don't forget to keep you social network accounts up to date (CV, etc).
  • Write a blog!  It is a quick and easy way to begin sharing your knowledge and information. Keep it fresh and current.
  • Very importantly, try to ensure you have the right work / life balance.

Feel free to choose one or more (or none) from the above to add to your own list.

Which ever resolutions you chose try to remember to keep them specific, realistic and attainable.

They can be small or large but hopefully they can be achieved with the necessary planning and work. 

Notes:

Some New Year's Resolutions for DBAs  - DbaPortal

What should a DBA do - XAPRB

The toughest thing for independents saying no - brentozar

The basics of personal branding - brentozar

Just say no - sqlservercentral

Building better communication skills - sqlservercentral