PowerShell scripts for setting up Oracle 21c/XE with ROA application: - Automated tablespace, user creation and imports - sqlnet.ora config for Instant Client 11g/ODBC compatibility - Oracle 21c read-only Home path handling (homes/OraDB21Home1) - Listener restart + 10G password verifier for legacy auth - Tested on VM 302 with CONTAFIN_ORACLE schema import Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
145 lines
5.1 KiB
Plaintext
145 lines
5.1 KiB
Plaintext
# =============================================================================
|
|
# Oracle Data Pump Import Parameter File - Company Schema Template
|
|
# =============================================================================
|
|
#
|
|
# Purpose: Template for importing company schemas (FIRMANOUA, COMPANY1, etc.)
|
|
#
|
|
# Usage:
|
|
# 1. Copy this file to import-COMPANYNAME.par
|
|
# 2. Replace COMPANY_NAME with actual schema name
|
|
# 3. Run: impdp system/password@service parfile=import-COMPANYNAME.par
|
|
#
|
|
# Or create dynamically:
|
|
# $company = "FIRMA1"
|
|
# (Get-Content import-company.par) -replace 'COMPANY_NAME', $company |
|
|
# Set-Content "import-$company.par"
|
|
# impdp system/pass@service parfile="import-$company.par"
|
|
#
|
|
# Prerequisites:
|
|
# 1. DMPDIR directory exists
|
|
# 2. COMPANY_NAME.dmp file is in C:\DMPDIR
|
|
# 3. COMPANY_NAME user created with appropriate tablespace quota
|
|
#
|
|
# =============================================================================
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Source and Destination
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Oracle directory object containing DMP files
|
|
DIRECTORY=DMPDIR
|
|
|
|
# Source dump file name
|
|
# IMPORTANT: Replace COMPANY_NAME with actual company name
|
|
DUMPFILE=COMPANY_NAME.dmp
|
|
|
|
# Import log file (will be created in DMPDIR)
|
|
LOGFILE=import_COMPANY_NAME.log
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Schema Configuration
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Schema mapping (source:target)
|
|
# Use when source and target schema names are the same
|
|
REMAP_SCHEMA=COMPANY_NAME:COMPANY_NAME
|
|
|
|
# Alternative: If importing to different schema name
|
|
# REMAP_SCHEMA=OLD_COMPANY:NEW_COMPANY
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Import Behavior
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Action when table already exists:
|
|
# SKIP - Skip existing tables (preserves existing data) - USE FOR MIGRATION
|
|
# APPEND - Add rows to existing tables
|
|
# TRUNCATE - Delete existing rows, then import
|
|
# REPLACE - Drop and recreate tables - USE FOR FRESH INSTALL
|
|
TABLE_EXISTS_ACTION=SKIP
|
|
|
|
# Transform OID to avoid conflicts
|
|
TRANSFORM=OID:N
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Performance Settings
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Number of parallel worker processes
|
|
PARALLEL=2
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Tablespace Remapping
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Remap tablespace if source uses different tablespace
|
|
# Common scenario: source uses ROA tablespace, target uses USERS
|
|
# REMAP_TABLESPACE=ROA:USERS
|
|
|
|
# If source uses multiple tablespaces:
|
|
# REMAP_TABLESPACE=ROA:USERS,ROA2:USERS,SYSTEM:USERS
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Exclusions
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Exclude statistics (will be recalculated after import)
|
|
EXCLUDE=STATISTICS
|
|
|
|
# Exclude grants (will be recreated by setup scripts)
|
|
# EXCLUDE=GRANT
|
|
|
|
# Exclude specific objects
|
|
# EXCLUDE=TABLE:"='TEMP%'"
|
|
# EXCLUDE=INDEX:"='IDX_LOG%'"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Data Filtering (Optional)
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Filter specific tables
|
|
# QUERY=TABLEDATA:"WHERE ROWNUM < 1000"
|
|
|
|
# Include only specific tables
|
|
# INCLUDE=TABLE:"IN ('TABLE1','TABLE2')"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Advanced Options
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Skip errors and continue
|
|
# DATA_OPTIONS=SKIP_CONSTRAINT_ERRORS
|
|
|
|
# Disable logging during import (faster but no recovery)
|
|
# TRANSFORM=DISABLE_ARCHIVE_LOGGING:Y
|
|
|
|
# =============================================================================
|
|
# Expected Objects in Company Schema:
|
|
#
|
|
# - Tables: gestiune, contabilitate, salarii (~200 tables)
|
|
# - Views: Various reports and lookups (~100 views)
|
|
# - Packages: Business logic packages (~50)
|
|
# - Procedures/Functions: Various (~200)
|
|
# - Triggers: Various (~100)
|
|
# - Indexes: Performance indexes (~500)
|
|
#
|
|
# Total: ~3000+ objects
|
|
# =============================================================================
|
|
|
|
# =============================================================================
|
|
# Post-Import Steps:
|
|
#
|
|
# 1. Gather statistics:
|
|
# EXEC DBMS_STATS.GATHER_SCHEMA_STATS('COMPANY_NAME');
|
|
#
|
|
# 2. Recompile invalid objects:
|
|
# EXEC UTL_RECOMP.RECOMP_SERIAL('COMPANY_NAME');
|
|
#
|
|
# 3. Create public synonym (if needed):
|
|
# CREATE PUBLIC SYNONYM table_name FOR COMPANY_NAME.table_name;
|
|
#
|
|
# 4. Grant privileges:
|
|
# GRANT SELECT ON COMPANY_NAME.table_name TO PUBLIC;
|
|
#
|
|
# =============================================================================
|