• About
  • Everyday Linux Commands

<roughCode/>

~ …so I can find it

Category Archives: Databases

Get Oracle database version

11 Monday Aug 2014

Posted by Scott in Databases, Oracle

≈ Comments Off on Get Oracle database version

Tags

Oracle

SELECT * FROM V$VERSION

Returns something like this…

Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 – 64bit Production
PL/SQL Release 11.1.0.6.0 – Production
CORE 11.1.0.6.0 Production
TNS for Linux: Version 11.1.0.6.0 – Production
NLSRTL Version 11.1.0.6.0 – Production

Advertisement

Oracle group by hour

05 Monday Nov 2012

Posted by Scott in Databases, Oracle

≈ Comments Off on Oracle group by hour

Tags

Oracle

Code:
SELECT TRUNC(datecol, ‘HH24’) FROM mytable
GROUP BY TRUNC(datecol, ‘HH24’);

from http://stackoverflow.com/questions/5111396/sql-group-by-date-hour (I liked this solution better)

SQL Server group by dates

24 Monday Sep 2012

Posted by Scott in Databases, MS SQL Server

≈ Comments Off on SQL Server group by dates

Tags

SQL

see http://www.sqlhacks.com/Dates/GroupByMonth

An example…after the jump…

Continue reading →

MS SQL Server 2008: force server to listen on a particular port

18 Wednesday Jul 2012

Posted by Scott in Databases, MS SQL Server

≈ Comments Off on MS SQL Server 2008: force server to listen on a particular port

Tags

SQL Server

Trying to make a dev server instance listen on the same port as the production counterpart. Had to remove the 0 for each IP address and set the desired port for the IPALL section…see http://msdn.microsoft.com/en-us/library/ms177440.aspx

To assign a TCP/IP port number to the SQL Server Database Engine

  1. In SQL Server Configuration Manager, in the console pane, expand SQL Server Network Configuration, expand Protocols for <instance name>, and then double-click TCP/IP.
  2. In the TCP/IP Properties dialog box, on the IP Addresses tab, several IP addresses appear in the format IP1, IP2, up to IPAll. One of these is for the IP address of the loopback adapter, 127.0.0.1. Additional IP addresses appear for each IP Address on the computer. Right-click each address, and then click Properties to identify the IP address that you want to configure.
  3. If the TCP Dynamic Ports dialog box contains 0, indicating the Database Engine is listening on dynamic ports, delete the 0.
  4. In the IPn Properties area box, in the TCP Port box, type the port number you want this IP address to listen on, and then click OK.
  5. In the console pane, click SQL Server Services.
  6. In the details pane, right-click SQL Server (<instance name>) and then click Restart, to stop and restart SQL Server.

After you have configured SQL Server to listen on a specific port, there are three ways to connect to a specific port with a client application:

  • Run the SQL Server Browser service on the server to connect to the Database Engine instance by name.
  • Create an alias on the client, specifying the port number.
  • Program the client to connect using a custom connection string.

MS SQL Server check data file free space

18 Wednesday Jul 2012

Posted by Scott in Databases, MS SQL Server

≈ Comments Off on MS SQL Server check data file free space

Tags

SQL Server

Because your filegroup will run out of space sooner or later…

SELECT DB_NAME() AS DbName, 
name AS FileName,
size/128.0 AS CurrentSizeMB, 
size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT)/128.0 AS FreeSpaceMB
FROM sys.database_files;

MS SQL Server transaction log full and out of disk space

18 Wednesday Jul 2012

Posted by Scott in Databases, MS SQL Server

≈ Comments Off on MS SQL Server transaction log full and out of disk space

Tags

SQL Server

Not sure where I was headed with this one…

http://social.msdn.microsoft.com/forums/en-US/sqlgetstarted/thread/e02df6ff-624c-48e1-aab3-99e46ead349a/ 

error like

Alter failed for Database (Microsoft.SqlServer.Smo) The transaction log for database is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases (Microsoft SQL Server, Error: 9002)

you can refer this thread it will answer your questions,

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2728787&SiteID=1

When your log file has grown enormously you have 2 options to curtail the growth,

  1. Take a transaction log backup which will truncate the log file and then perform shrinking of log file using DBCC SHRINKFILE statement it will be successful.
  2. You can execute the command Backup log your database name with truncate_only (or backup log your database name with no_log) and shrink the log file. But running those commands (backup log with truncate_only or no_log) will truncate the log file but will break the log chain and hence it should NEVER BE USED. The ONLY case it can be used is when the disk in which the transaction log resides is completely FULL and there is no way to clear the disk space.

– Deepak

Recent Posts

  • Bulk commands to install PHP and MySQL on CentOS 7
  • Four year gap? No, had just been self-hosting for a while
  • winhttpcertcfg.exe Example
  • Configure Tomcat 7 to use HTTPS
  • SCP on Mac (and a tool for Windows)

Archives

  • November 2018
  • October 2018
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012

Categories

  • Apache Tomcat
  • Apache Web Server
  • Application Servers
  • C#
  • CMS
  • Code Samples
  • Databases
  • Development Tools
  • Drupal
  • IIS
  • Java
  • Linux / UNIX
  • MS SQL Server
  • Networking
  • Operating Systems
  • Oracle
  • Uncategorized
  • Video Games
  • Windows
  • WordPress

Meta

  • Register
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.com

Blog at WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • <roughCode/>
    • Already have a WordPress.com account? Log in now.
    • <roughCode/>
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar