Helpful Oracle hints I've found and saved
Currently Browsing: SQL Queries

Copy Data From 1 Column To Another

Here's the answer to my question "How do I copy the data from 1 column to another?": UPDATE yourTableName SET columnTwoDestination = columnOneSource; That will copy EVERY record's value from the source column (columnOneSource) to the destination column (columnTwoDestination). If you want to only do it for specific records, just add the "WHERE" clause: UPDATE yourTableName SET columnTwoDestination = columnOneSource...

How To See What Queries Are Running

Let's say you're running a long job, or somebody else is running a long job, (for example, a MASSIVE import into the database) and you'd like to see what the query is that's running. Well, you could use all the pretty little tools in Oracle Enterprise Manager (OEM), or, if you're at the command line already, you could use SQL*Plus. Here's a nice "little" query that shows what queries are running against your Oracle...

Find out which Oracle Instance you're connected to

Here's a quick little sql query that shows what Oracle instance (what database) you're connected to: SELECT sys_context('USERENV','DB_NAME') AS Instance FROM dual; And that's all thanks to:

How to find all the Oracle Datafiles in a Database

I was going to modify the database today by resizing all the datafiles because I need space on the server (for our dev box). There may be better ways to do this, and that's what the comment box at the bottom of this page is for, but with the extremely tight space limitations, and limited time frame to complete this, I needed a quick way to do it. So, I followed this procedure: Exported all data using "exp" –...
Powered by WordPress | Designed by Elegant Themes

Pin It on Pinterest