Wednesday, April 23, 2008

Enabling > 4GB RAM Support with Oracle 10g Running on Windows Server 2003 32-bit Ed.

  1. Add the /3G, USERENV, and /PAE switches to the boot.ini file, on the Windows Server 2003 Server. For example: multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Windows Server 2003" /fastdetect /NoExecute=OptIn /3GB /USERENV /PAE
  2. The account that is used to start the Oracle Service must be given the "Lock Pages in Memory" right. You can do this by a) going to Administrative Tools, from the Start menu or Control Panel, b) opening Local Security Policy, c) opening Local Policies, then d) opening User Rights Assignment; e) open/edit the "Lock Pages in Memory" key, f) then add the Oracle Service account to this list.
  3. Create an AWE_WINDOW_MEMORY String (REG_SZ) registry key in the Windows' Registry, under HKLM\Software\Oracle\h, where h is the ORACLE_HOME you're targeting. Set this value to the following calculated value (you can calculate this value via the calculator below):
    SETS_PER_POOL = 2 * CPU_COUNT (if VLM is enabled; VLM is enabled by setting USE_INDIRECT_DATA_BUFFERS=TRUE) SETS_PER_POOL = CPU Count / 2 (If VLM is NOT enabled _DB_BLOCK_LRU_LATCHES = (8 * SETS_PER_POOL) AWE_WINDOW_MEMORY (min.) = ((4096 * DB_BLOCK_SIZE * _DB_BLOCK_LRU_LATCHES) / 8) * 1.03125
    So, in a server with 8GB of RAM with 4 CPUs and a DB_BLOCK_SIZE of 8192, the AWE_WINDOW_MEMORY would be ((((2 * 4) * 8) * 4096 * 8192) / 8) * 1.03125 = 276824064.
  4. Set the _DB_BLOCK_LRU_LATCHES DB instance parameter according to the preceding formula.
  5. Set the DB instance parameter use_indirect_data_buffers to TRUE.
  6. Ensure that the DB instance parameter db_cache_size is NOT set.
  7. Set the DB instance parameter db_block_buffers to the following calculated value (you can use the calculator below instead):
    db_block_buffers = (Total RAM - 4GB + AWE_WINDOW_MEMORY) / DB_BLOCK_SIZE
    So, using the preceding example, the db_block_buffers parameter value would be 786432.
  8. Set the DB instance parameter PGA_AGGREGATE_TARGET to ( * 80%) * 40%.
  9. Ensure the DB instance parameter sga_target is NOT set.
  10. Set the DB instance parameter shared_pool_size to AWE_WINDOW_MEMORY * 1.27923, at the very minimum.
  11. Ensure that the streams_pool is NOT set to 0 if you will be using utilities such as the Data Pump ones (e.g., expdp and impdp). 1MB is a good start.
  12. Restart the server and related Oracle services and DB(s).

Note: The CPU count includes hyperthreaded processors, so in a dual-core processor, the CPU count would be 2, not 1.

Set these values:
Is VLM enabled?
CPU_COUNT =
DB_BLOCK_SIZE =
Total RAM =
Results:
SETS_PER_POOL
_DB_BLOCK_LRU_LATCHES =
AWE_WINDOW_MEMORY (min.) =
AWE_WINDOW_MEMORY (rec.) =
DB_BLOCK_BUFFERS =
PGA_AGGREGATE_TARGET (min.) =
PGA_AGGREGATE_TARGET (rec.) =
SHARED_POOL_SIZE (min.) =
SHARED_POOL_SIZE (rec.) =

Thursday, April 10, 2008

Configuring Search for SharePoint Server (MOSS) 2007

  1. Open up the MOSS administration site.
  2. Open up the Shared Services Administration site.
  3. In the Search section, click on Search Settings.
  4. Click on "Default content access account".
  5. Change the account and password to match an account that has access to ALL of the sites and its content.
  6. Click on OK.
  7. Click on Crawl Rules.
  8. If no crawl rules are defined, define them by adding them.
  9. Click on New Crawl Rule.
  10. Enter the full path to the base site collection in the Path field. Append an asterisk (*) at the end of the URL to indicate searching all subsites of this URL.
  11. Select the "Include all items in this path" option.
  12. Click on OK.
  13. Click on "Content sources and crawl schedules".
  14. Click on "Local Office SharePoint Server sites".
  15. In the Crawl Schedules section, click on the Create schedule link under the Full Crawl drop-down list.
  16. Set the options, then click on OK.

Friday, April 04, 2008

Backing up a SharePoint (MOSS) 2007 Site

  1. Setup a writable share with write permissions, specfically granting the SharePoint (MOSS) 2007 server read and write permissions to this share. For example, if the MOSS server is named TEST, grant DOMAIN\TEST$ read and write permissions to this share (where DOMAIN is the domain or workgroup the server belongs to, and TEST$ is the computer's account name on the domain/workgroup). For this example, a share has been setup on the TEST server called MOSSBackup
  2. Open up a command prompt on the MOSS server (cmd).
  3. Navigate to the BIN folder:cd "%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\12\BIN"
  4. Execute the following command to perform a full backup of the MOSS databases, sites, etc.:stsadm -o backup -backupmethod full -directory \\TEST\MOSSBackup
  5. Add this command to a nightly scheduled task.

Implementing Oracle 10g Data Guard for Standby/Failover Availability

This tutorial demonstrates how to setup Data Guard in the Windows version of Oracle Database 10g. I am assuming you already know how to restart database instances and listeners.

Notes: Oracle Enterprise Manager requires that the database instance it manages be accessible via a Net name. In other words, ensure that a tnsnames.ora file is setup to point to the instance, correctly. DB_UNIQUE_NAME refers to a globally unique name. SERVICE_NAMES refers to one or more service-based names which are registered with the TNS listener. If SERVICE_NAMES is empty, the instance registers with the TNS listener a service name in the following format: DB_UNIQUE_NAME.DB_DOMAIN. Dont' confuse what's in SERVICE_NAMES with a "service name". service names are, typically, Oracle Net names as defined in a tnsnames.ora file, and it's how Oracle Net applications such as SQL*Plus communicate with DB instances. A SID is equivalent to a DB name, or DB_NAME, not a service name, so don't confuse SID with service names either.

Preparing the Source/Primary Database

  1. Login to Oracle Enterprise Manager (typically the shortcut named "Database Control - SID").
  2. Click on Administration.
  3. Click on "All Initialization Parameters".
  4. Ensure that the remote_login_passwordfile parameter is set to "EXCLUSIVE" (without quotes). If it's not, create an exclusive password via the "orapwd" (without quotes) command, then set it. You can set the parameter via an SQL command:ALTER SYSTEM SET remote_login_passwordfile = 'EXCLUSIVE' SCOPE=SPFILE
  5. The DB_NAME parameter must be the same for both the source and target databases. The database name is NOT case sensitive. This is just a note, not anything that needs to be done or set at this point.
  6. The DB_UNIQUE_NAME parameter must be unique for both the source and target databases. If they're not, set them via the Oracle Enterprise Manager. For now, just ensure that the primary/target DB has a unique DB name. Per Oracle, the default value of DB_UNIQUE_NAME is the value of DB_NAME, and DB_UNIQUE_NAME can be up to 30 characters and is case insensitive. The following characters are valid in a database name: alphanumeric characters, underscore (_), number sign (#), and dollar sign ($).
    Alternatively, you can issue the following SQL command:alter system set db_unique_name = 'unique_name' scope=spfileNOTE: Be careful when changing this value. When the SERVICE_NAMES parameter is empty, the instance will register with the TNS listener the DB_UNIQUE_NAME and DB_DOMAN parameters to form a unique, global service name. It's automatically determined. Therefore, BEFORE changing the DB_UNIQUE_NAME, ensure you set the SERVICE_NAMES parameter to include the original service name registered with the TNS listener for this DB instance ALONG with the new DB_UNIQUE_NAME.DB_DOMAIN service name that would've changed. Otherwise, applications such as Oracle Enterprise Manager will not work because they will refer to an service name that no longer exists. So, for example, if the original service name setup for use with OEM was dgtest.dotnetfun.local, and the new DB_UNIQUE_NAME for that DB instance is dgtest_primary, the SERVICE_NAMES parameter would be set to 'dgtest.dotnetfun.local', 'dgtest_primary.dotnetfun.local'.
  7. The SERVICE_NAMES parameter must be unique for both the source and target databases. If they're not, set them via the Oracle Enterprise Manager as specified above. Alternatively, you can use following SQL command:ALTER SYSTEM SET service_names = 'service_name' SCOPE=SPFILENOTE: Again, be careful not to remove the original service name setup for use with Oracle Enterprise Manager, as OEM references the instance this way, and removing it will proably render OEM useless. The default value, per Oracle, is DB_NAME.DB_DOMAIN.
  8. Set the LOG_ARCHIVE_CONFIG parameter to something like this: 'DG_CONFIG=(source_db_unique_name,target_db_unique_name)' (without single quotes, where source_db_unique_name is the unique DB name of the primary DB and target_db_unique_name is the unique DB name of the standby DB. You can do this via Oracle Enterprise Manager or, alternatively, by issuing the following SQL command: ALTER SYSTEM SET log_archive_config = 'DG_CONFIG=(source_db_unique_name,target_db_unique_name)' SCOPE=SPFILE
  9. Set the LOG_ARCHIVE_DEST_1 parameter to point to the source archive log destination, via an SQL command:ALTER SYSTEM SET log_archive_dest_1 = 'LOCATION=archive_log_dir VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=db_unique_name' SCOPE=SPFILE
  10. Set the LOG_ARCHIVE_DEST_2 parameter to point to the target archive log destination, via an SQL command:ALTER SYSTEM SET log_archive_dest_2 = 'SERVICE=target_service_name VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=db_unique_name' SCOPE=SPFILE Note that SERVICE here refers to a TNS service name/alias that points to the standby/target DB instance, typically, via a tnsnames.ora service/alias stored on the primary DB.
  11. Set the LOG_ARCHIVE_DEST_STATE_1 and LOG_ARCHIVE_DEST_STATE_2 parameters to ENABLED either via OEM or an SQL command:ALTER SYSTEM SET log_archive_dest_state_1 = "ENABLE" SCOPE=SPFILE; ALTER SYSTEM SET log_archive_dest_state_2 = "ENABLE" SCOPE=SPFILE;
  12. Set the FAL_SERVER parameter to the service name/alias of the source/primary DB, either via OEM or an SQL command:ALTER SYSTEM SET fal_server = 'source_service_name' SCOPE=SPFILE
  13. Set the fal_client parameter to the service name/alias of the target/standby DB, either via OEM or an SQL command:ALTER SYSTEM SET fal_client = 'target_service_name' SCOPE=SPFILE
  14. If the source and target DBs use different DB data file locations/folders, specify both the source and target locations via the db_file_name_convert parameter, either via OEM or an SQL command, starting with the source path, then the target path:ALTER SYSTEM SET db_file_name_convert = 'E:\oracle\product\10.2.0\oradata\Test1\','C:\oracle\product\10.2.0\oradata\test1\' SCOPE=SPFILE
  15. If the source and target DBs use different log file locations/folders (NOT archive log files), specify both the source and target locations via the log_file_name_convert parameter, either via OEM or an SQL command, starting with the source path, then the target path:ALTER SYSTEM SET log_file_name_convert = 'E:\oracle\product\10.2.0\flash_recovery_area\TEST1\ARCHIVELOG','C:\oracle\product\10.2.0\flash_recovery_area\TEST1\ARCHIVELOG' SCOPE=SPFILE
  16. Set the standby_file_management parameter to AUTO, either via OEM or an SQL command:ALTER SYSTEM SET standby_file_management = 'AUTO' SCOPE=SPFILE
  17. If the source database is not already in archive log mode, perform the following SQL commands:shutdown immediate; startup mount; alter database archivelog; alter database open;To test that archiving is working, force a log switch by issuing the following SQL command:ALTER SYSTEM SWITCH LOGFILE;
  18. Perform a cold backup of the source/primary DB's data files. Shutdown the database first, then copy all data files, control files, and online redo log files. After that's done, startup the DB again.
  19. Create a standby control file for the target/standby DB by issuing the following SQL command:alter database create standby controlfile as 'path\test1_mtgvm1.ctl';Replace path with the directory where the control file is to be created.
  20. Create and edit an initialization file for the target/standby DB by issuing the following SQL command:create pfile=path\initSID.ora' from spfile;Replace path with the directory where you want the init file created and SID with the unique DB name of the target/standby DB.
  21. Edit the target/standby init file so that the following parameters apply to the target/standby DB: DB_UNIQUE_NAME, SERVICE_NAMES, CONTROL_FILES, DB_FILE_NAME_CONVERT, LOG_FILE_NAME_CONVERT, LOG_ARCHIVE_DEST_n, INSTANCE_NAME, FAL_SERVER, and FAL_CLIENT. Switch the LOG_ARCHIVE_DEST_n values so that the source and target values are reversed, opposite in order. The same goes for the DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT values--their values should be switched so that the first path is the standy's and second is the primary's. Ensure that any paths that refer to the local, standby DB are accurate. Ensure that the COMPATIBLE parameter is the same for both the primary and standby databases.

Preparing the Target/Standby Database

  1. Copy the data files, control files, and initialization file to the standby/target server/location, ensuring that they are placed in the proper directories and match paths specified in the initialization file, specifically according to paths defined in the following parameters: CONTROL_FILES, DB_FILE_NAME_CONVERT, LOG_FILE_NAME_CONVERT.

Wednesday, April 02, 2008

ORA-02156, ORA-00911, and other Oracle Errors During Database Configuration Assistant Creation of Database

If you get ORA-02156, ORA-00911, and other Oracle errors during a database creation process via the Database Configuration Assistant, it's most likely due to an account password that contains odd characters, such as spaces and other non-alpha-numeric characters.

Choose a typical alpha-numeric password, then change it once accounts and databases have been created.