Tuesday, October 30, 2012

EXCEL tips

1. How to enter soft break in EXCEL
ALT+ENTER

2. How to fill an Excel column with consecutive numbers without typing each one separately?

Put 1 in the first row, first column.
Put 2 in the 2nd row, first column.
Highlight both. Then drag your cursor down. They will auto-number themselves.
or
Click and drag the first value that enter into the first cell.

Then go to Edit / Fill / series .. and click on "step value" and enter 1.

Friday, October 26, 2012

Oracle Database Automatic Startup and Shutdown on UNIX

Oracle 10gR2 and RMAN duplicate and errors: ORA-19870, ORA-19505, ORA-27037


When coping backup files from target database server to auxiliary database server, then trying to duplicate a database on a new server using Oracle RMAN 10gR2, the following error occurred:

channel ORA_AUX_DISK_1: reading from backup piece /backup/DB/rman/DB_dbf_s2076_p1_t793477838_cold_disk.bck
ORA-19870: error reading backup piece /backup/DB/rman/DB_dbf_s2076_p1_t793477838_cold_disk.bck
ORA-19505: failed to identify file "/backup/DB/rman/DB_dbf_s2076_p1_t793477838_cold_disk.bck"
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
failover to previous backup

Solution: Add backup files to the Recovery Catalog

Cataloging Older Files in the Recovery Catalog
If you have datafile copies, backup pieces or archive logs on disk, you can catalog them in the recovery catalog using the CATALOG command. When using a recovery catalog, cataloging older backups that have aged out of the control file lets RMAN use the older backups during restore operations. 

For example:
RMAN> CATALOG DATAFILECOPY '/disk1/old_datafiles/01_01_2003/users01.dbf';
RMAN> CATALOG ARCHIVELOG '/disk1/arch_logs/archive1_731.dbf', 
     '/disk1/arch_logs/archive1_732.dbf';
RMAN> CATALOG BACKUPPIECE '/disk1/backups/backup_820.bkp';


You can also catalog multiple backup files in a directory at once, using the CATALOG START WITH command, as shown in this example:
RMAN> CATALOG START WITH '/disk1/backups/';



Thursday, October 18, 2012

Principals - SQL Server


Principals - SQL Server


Principals are entities that can request SQL Server resources. Like other components of the SQL Server authorization model, principals can be arranged in a hierarchy. The scope of influence of a principal depends on the scope of the definition of the principal: Windows, server, database; and whether the principal is indivisible or a collection. A Windows Login is an example of an indivisible principal, and a Windows Group is an example of a principal that is a collection. Every principal has a security identifier (SID).
Windows-level principals
  • Windows Domain Login
  • Windows Local Login
SQL Server-level principal
  • SQL Server Login
Database-level principals
  • Database User
  • Database Role
  • Application Role
The SQL Server sa log in is a server-level principal. By default, it is created when an instance is installed. In SQL Server 2005 and SQL Server 2008, the default database of sa is master. This is a change of behavior from earlier versions of SQL Server.
Every database user belongs to the public database role. When a user has not been granted or denied specific permissions on a securable, the user inherits the permissions granted topublic on that securable.

INFORMATION_SCHEMA and sys

Every database includes two entities that appear as users in catalog views: INFORMATION_SCHEMA and sys. These entities are required by SQL Server. They are not principals, and they cannot be modified or dropped.
Server principals with names enclosed by double hash marks (##) are for internal system use only. The following principals are created from certificates when SQL Server is installed, and should not be deleted.
  • ##MS_SQLResourceSigningCertificate##
  • ##MS_SQLReplicationSigningCertificate##
  • ##MS_SQLAuthenticatorCertificate##
  • ##MS_AgentSigningCertificate##
  • ##MS_PolicyEventProcessingLogin##
  • ##MS_PolicySigningCertificate##
  • ##MS_PolicyTsqlExecutionLogin##
By definition, a client and a database server are security principals and can be secured. These entities can be mutually authenticated before a secure network connection is established. SQL Server supports the Kerberos authentication protocol, which defines how clients interact with a network authentication service.
For more information about the SQL Server implementation of Kerberos support, see Kerberos Authentication and SQL Server.

Wednesday, October 17, 2012

BUILTIN\Administrator and SQL Server 2008


BUILTIN\Administrator

By default, the local Windows Group BUILTIN\Administrator is no longer included in the SQL Server sysadmin fixed server role on new SQL Server 2008 installations.

If your processes or code depend on Windows BUILTIN\Administrator local group access, you must explicitly grant permission to log on to SQL Server. Accounts are no longer automatically granted access to SQL Server because of their membership in the Windows Administrator group.

Refer to: http://msdn.microsoft.com/en-us/library/cc280562(v=sql.105).aspx

Tuesday, October 16, 2012

Permissions of SQL Server Fixed Database Roles

Fixed database roles can be mapped to the more detailed permissions that are included in SQL Server. 

Fixed database roles are provided for convenience and backward compatibility. 

All fixed database roles are granted with Server-level permission VIEW ANY DATABASE.

Fixed database role
Database-level permission
db_accessadmin
Granted: ALTER ANY USER, CREATE SCHEMA
Granted with GRANT option: CONNECT
db_backupoperator
Granted: BACKUP DATABASE, BACKUP LOG, CHECKPOINT
db_datareader
Granted: SELECT
db_datawriter
Granted: DELETE, INSERT, UPDATE
db_ddladmin
Granted: ALTER ANY ASSEMBLY, ALTER ANY ASYMMETRIC KEY, ALTER ANY CERTIFICATE, ALTER ANY CONTRACT, ALTER ANY DATABASE DDL TRIGGER, ALTER ANY DATABASE EVENT, NOTIFICATION, ALTER ANY DATASPACE, ALTER ANY FULLTEXT CATALOG, ALTER ANY MESSAGE TYPE, ALTER ANY REMOTE SERVICE BINDING, ALTER ANY ROUTE, ALTER ANY SCHEMA, ALTER ANY SERVICE, ALTER ANY SYMMETRIC KEY, CHECKPOINT, CREATE AGGREGATE, CREATE DEFAULT, CREATE FUNCTION, CREATE PROCEDURE, CREATE QUEUE, CREATE RULE, CREATE SYNONYM, CREATE TABLE, CREATE TYPE, CREATE VIEW, CREATE XML SCHEMA COLLECTION, REFERENCES
db_denydatareader
Denied: SELECT
db_denydatawriter
Denied: DELETE, INSERT, UPDATE
db_owner
Granted with GRANT option: CONTROL
db_securityadmin
Granted: ALTER ANY APPLICATION ROLE, ALTER ANY ROLE, CREATE SCHEMA, VIEW DEFINITION
dbm_monitor
Granted: VIEW most recent status in Database Mirroring Monitor
Important noteImportant
The dbm_monitor fixed database role is created in the msdb database when the first database is registered in Database Mirroring Monitor. The new dbm_monitor role has no members until a system administrator assigns users to the role.

For more info: http://msdn.microsoft.com/en-us/library/ms189612(v=sql.105).aspx

Thursday, October 11, 2012

Changing SQL Server Database Owner


Changing the SQL Server Database Owner

In SQL Server, the owner of the current database can be changed. Any user, a SQL Server login or Microsoft Windows user, who has access to connect to SQL Server can become the owner of a database.

Ownership of the system databases cannot be changed.

ALTER AUTHORIZATION can be used to change the ownership of any entity that has an owner. Ownership of database-contained entities can be transferred to any database-level principal. Ownership of server-level entities can be transferred only to server-level principals.

ALTER AUTHORIZATION ON DATABASE::[my_db] TO [sa];

Reference:

Changing the Database Owner: http://msdn.microsoft.com/en-us/library/ms190909(v=sql.105).aspx

ALTER AUTHORIZATION (Transact-SQL): http://msdn.microsoft.com/en-us/library/ms187359(v=sql.105).aspx

Wednesday, October 10, 2012

guest user should not be disabled in the msdb database in SQL Server


guest user should not be disabled in the msdb database in SQL Server

SQL Server Books Online recommends that you disable the guest user in every database as a best practice for securing the database server. This recommendation does not apply to master, msdb, and tempb system databases.

In order for some Microsoft SQL Server features to work, the guest user must be enabled in the msdb database.

More info: http://support.microsoft.com/kb/2539091