Monday, May 16, 2011

How to move a Oracle Datafile to another partition

1) Query and write down the current location of the datafiles from the V$DATAFILE view: SELECT name FROM v$datafile;

2) Connect to SQL Plus as sysdba

3) Run the following commands from SQL Plus:

* SHUTDOWN IMMEDIATE

* HOST MOVE <<original location file>> <<new location file>>

* STARTUP MOUNT

* ALTER DATABASE RENAME FILE <<original file location obtained from step 1>> - (press enter after the dash)
> TO <<new file location>>; (the semicolon is important)


* ALTER DATABASE OPEN;
4) Repeat the initial query so you can verify that the the datafile has been renamed in the data dictionary


Note: file locations must be between apostrophes '...............'

Monday, May 9, 2011

How do I shrink the sharepoint databases log file?


The following article worked for me with SQL Server 2008 R2


There are other articles with SQL commands that only work in previous versions of SQL Server. Truncate_Only has been deprecated by MS.