Category: Programming


Shrink database sql server

This note is just to remind me about shrinking database file to get more free space from database log. Step by step is:

Backup full database and database related
Backup database transaction log
Run code below for checking current database and log size. With this code, we also can get database log name that will be used.

SELECT
–DB_NAME(database_id) AS DatabaseName,
–Physical_Name,
Name AS Logical_Name,
(size*8)/1024 SizeMB
FROM
sys.master_files
WHERE
DB_NAME(database_id) = ‘tempdb’ — database name that will be Shrinked (change)
GO

Run this code for shrinking database:

USE tempdb;
GO
— Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE tempdb
SET RECOVERY SIMPLE WITH NO_WAIT;
GO
— Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE(tempdb_log, 1); –file_name is the logical name of the file to be shrink
GO
— Reset the database recovery model.
ALTER DATABASE tempdb
SET RECOVERY FULL WITH NO_WAIT;
GO

Done


ORA-01747: invalid user.table.column, table.column, or column specification

Aneh bin ajaib, banyak cara dan berbagai cara telah dilakukan dan memasukkan data tabel ke kolom yang satu ini tidak bisa-bisa. Padahal kolomnya hanya tiga saja dan mencoba memasukkan data lewat sql developernya oracle tidak masalah. Sudah mengecek trigger dan sequence autoincrement tabel, siapa tahu belum dimasukkan dan tidak bermasalah.

Mencoba menghapus dan mendrop tabel, tidak bisa jadi juga, resourcenya lagi dipakai, najislah. Mencoba membuat tabel baru yang serupa dan sama biar fresh dan bersih, dicoba dengan membuat yang paling sederhana, tetap saja hasilnya dengan nihil. Mencoba hasilnya dengan memasukkan data lewat kodingan sederhana, tetap saja hasilnya yang palin keren yaitu error ORA-01747: invalid user.table.column, table.column, or column specification. Terjadilah pending works dan mau tak mau harus dicari penyebabnya dan dituntaskan secara kodingan.

Setelah beberapa saat dan ngantuk-ngantuk dan tiba-tiba ada pencerahan, ketikkan ORA-01747 di om Google dan …


Content Type application/soap+xml; charset=utf-8 was not supported by service

The remote server returned an error: (415) Cannot process the message because the content type ‘text/xml; charset=utf-8′ was not the expected type ‘application/soap+xml; charset=utf-8′..

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The remote server returned an error: (415) Cannot process the message because the content type ‘text/xml; charset=utf-8′ was not the expected type ‘application/soap+xml; charset=utf-8′..

First Google hit says:

this is usually a mismatch in the client/server bindings, where the message version in the service uses SOAP 1.2 (which expects application/soap+xml) and the version in the client uses SOAP 1.1 (which sends text/xml). WSHttpBinding uses SOAP 1.2, BasicHttpBinding uses SOAP 1.1.

It usually seems to be a wsHttpBinding on one side and a basicHttpBinding on the other.

My Solution:

Change wsHttpBinding to be basicHttpBinding …


HTTP Error 404.17 – Not Found, The requested content appears to be script and will not be served by the static file handler

Shortcut is run comman prompt and change directory to “c:\Windows\Microsoft.NET\Framework64\v3.0\Windows Communication Foundation>”, then run this command “ServiceModelReg.exe -i”

Location: C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation
Command Line: ServiceModelReg.exe –i

Some solutions can find here:

http://udonmez.wordpress.com/2011/02/10/http-error-404-17-not-found-the-requested-content-appears-to-be-script-and-will-not-be-served-by-the-static-file-handler/
http://blogs.cametoofar.com/post/WCF-HTTP-Error-40417-Not-Found-The-requested-content-appears-to-be-script-and-will-not-be-served-by-the-static-file-handler-IIS-7.aspx

 


Message: ORA-01843: not a valid month

This stuff makes me confuse and headache for a few days. Why? It is about date format in select query oracle. I don’t know if this has been an issue. I have select SQL query in ORACLE that contains date format, I use to_date(targetdate, ‘DD-MON-YY’) format. Every thing works well in development server that has database connection string to database development server using oracle, but when I change connection to database production server, some thing happens. No data appear and no error, a mystery. Why?

I need more than a hours to find the solutions. Every thing has been done, debug from visual studio and makes connection directly to production server, no error found and the data appear, copy database production and restore to development server, no error found and the data appear. But if I make connection directly from development …