Oracle Datapump Command

# Basic Data Pump Import Command Syntax impdp username/password DIRECTORY=directory_name DUMPFILE=dumpfile_name LOGFILE=logfile_name # Common Parameters: # 1. DIRECTORY - Specifies the directory object where the dump file is located. DIRECTORY=db_backup_dir # 2. DUMPFILE - Specifies the name of the dump file. You can use multiple files if needed. DUMPFILE=db_backup.dmp # 3. LOGFILE - Specifies the name of the log file to log the import process. LOGFILE=db_restore.log # 4. TABLES - Imports specific tables from the dump file. TABLES=hr.employees, hr.departments # 5. REMAP_SCHEMA - Remaps the source schema to a target schema during import. REMAP_SCHEMA=old_schema:new_schema # 6. REMAP_TABLESPACE - Remaps the source tablespace to a target tablespace. REMAP_TABLESPACE=old_tablespace:new_tablespace # 7. EXCLUDE - Excludes specific object types or objects from the import. Example: Exclude indexes. EXCLUDE=INDEX # 8. INCLUDE - Includes specific object types or objects for import. Example: Only import `employees` and `departments` tables. INCLUDE=TABLE:"IN ('EMPLOYEES', 'DEPARTMENTS')" # 9. CONTENT - Specifies whether to import only data (DATA_ONLY), only DDL (METADATA_ONLY), or both (ALL). CONTENT=DATA_ONLY # 10. ACCESS_METHOD - Specifies the method used for accessing the dump file (direct_path or external_table). ACCESS_METHOD=direct_path # 11. FULL - Imports the entire database. FULL=Y # 12. PARALLEL - Uses multiple parallel threads for faster import. PARALLEL=4 # 13. FLASHBACK_TIME - Imports data as it was at a specific point in time. FLASHBACK_TIME="TO_TIMESTAMP('2023-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS')" # 14. TRANSPORT_TABLESPACES - Imports specified transportable tablespaces. TRANSPORT_TABLESPACES=users # 15. CLUSTER - Used when importing a cluster. CLUSTER=Y # 16. SINGLE_TRANSACTION - Imports all objects in a single transaction. SINGLE_TRANSACTION=Y # 17. REMAP_DATAFILE - Remaps datafile names during import. REMAP_DATAFILE='/old/path/datafile.dbf'='/new/path/datafile.dbf' # 18. TABLE_EXISTS_ACTION - Specifies what action to take if a table already exists during import. Options: SKIP, APPEND, REPLACE, TRUNCATE. TABLE_EXISTS_ACTION=APPEND # Example: Import Specific Tables impdp dbning/12345 DIRECTORY=db_backup_dir DUMPFILE=dbning_backup.dmp LOGFILE=restore.log TABLES=hr.employees,hr.departments # Example: Remap Schema During Import impdp sys/12345 as sysdba DIRECTORY=db_backup_dir DUMPFILE=dbning_backup.dmp LOGFILE=restore.log REMAP_SCHEMA=old_schema:new_schema # Example: Import with Parallelism (4 threads) impdp sys/12345 as sysdba DIRECTORY=db_backup_dir DUMPFILE=dbning_backup.dmp LOGFILE=restore.log PARALLEL=4 # Example: Import Data Only (No DDL) impdp sys/12345 as sysdba DIRECTORY=db_backup_dir DUMPFILE=dbning_backup.dmp LOGFILE=restore.log CONTENT=DATA_ONLY # Example: Import Full Database impdp sys/12345 as sysdba DIRECTORY=db_backup_dir DUMPFILE=dbning_backup.dmp LOGFILE=restore.log FULL=Y # Example: Exclude Indexes During Import impdp sys/12345 as sysdba DIRECTORY=db_backup_dir DUMPFILE=dbning_backup.dmp LOGFILE=restore.log EXCLUDE=INDEX # Example: Flashback Import to a Specific Time impdp sys/12345 as sysdba DIRECTORY=db_backup_dir DUMPFILE=dbning_backup.dmp LOGFILE=restore.log FLASHBACK_TIME="TO_TIMESTAMP('2023-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS')"

December 9, 2024 · 2 min · 385 words · kidtz

MYSQL Shell Command

General Commands \help # Show help information \status # Display current connection and session status \quit or \exit # Exit MySQL Shell \clear # Clear the screen \history # Show command history \rehash # Update auto-completion data Session Management \connect user@host[:port] # Connect to a MySQL server \reconnect # Reconnect to the last session \disconnect # Disconnect from the current session \use database_name # Switch to a specific database Mode Switching \sql # Switch to SQL mode \js # Switch to JavaScript mode \py # Switch to Python mode Executing SQL Queries SELECT * FROM table_name; # Execute SQL queries (in SQL mode) session.runSql("SQL_QUERY"); # Execute SQL in JavaScript mode session.run_sql("SQL_QUERY") # Execute SQL in Python mode Working with Admin API dba.checkInstanceConfiguration(); # Check instance configuration dba.configureInstance(); # Configure an instance var cluster = dba.createCluster("name") # Create an InnoDB cluster cluster.addInstance("user@host"); # Add an instance to the cluster cluster.status(); # Get cluster status cluster.removeInstance("user@host"); # Remove an instance from the cluster Data Export and Import \util.dumpInstance("path", {options}); # Export instance data \util.loadDump("path", {options}); # Import data Script Execution \source /path/to/script.sql # Run a SQL script file Configuration Management \show defaultCharacterSet # Show default character set \set defaultCharacterSet=utf8mb4 # Set default character set Shell Customization \options # List shell options \set prompt "custom_prompt> " # Customize shell prompt

December 9, 2024 · 2 min · 217 words · kidtz

Install MYSQL Server Community

prereq Get repository wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm sudo rpm -ivh mysql57-community-release-el7-11.noarch.rpm Get key mysql rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 rpm -qa gpg-pubkey* ls -l /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Install Mysql Install mysql-server sudo yum install mysql-server Because MySQL is automatically installed you can use OS command for service management, for example to check if it’s already started sudo systemctl status mysqld Start MySQL if not started sudo systemctl start mysqld sudo systemctl enable mysqld sudo systemctl status mysqld Change root password Check the content of my.cnf, that is in default folder for linux OS and note the following info (lines that start with “#”are just comments) Where is the database and the error log (mysqld.log) stored? Check if there are error for the instance looking in the error log file Starting from MySQL 5.7 the default installation of MySQL Server generates a one-time password. You find it in error log notes above ...

December 9, 2024 · 2 min · 291 words · kidtz

Install Rac Oracle19c with ASM in local lab

Prerequisite Pastikan OS dapat membaca ASM disini saya menggunak oracle linux 7.8 dan saya perlu merubah kernel menjadi CHK karena disini defaultny adalah UEK grub2-set-default 1 uname -r reboot ubah selinux menjadi disabled agar tidak terlock /etc/selinux/config SELINUX=disabled ubah hostname disini saya menggunakan 2 node berikut contohnya hostnamectl set-hostname db1.db.com hostnamectl set-hostname db2.db.com tambahkan etc hosts dengan IP yang sudah di set pastikan IP Public , IP Virtual, IP Scan dalam satu segment yang sama ...

December 3, 2024 · 4 min · 848 words · kidtz

Database level use

Level database biasanya merujuk pada level di mana database beroperasi dalam infrastruktur atau aplikasi Ranking database desember 2024 Source : Database Ranking +------------------+-----------------------------------------------+-------------------------+ | DATABASE | BEST USE CASES | LEVEL | +------------------+-----------------------------------------------+-------------------------+ | Oracle Database | Mission-critical apps, ERP, data warehousing | Enterprise (High-tier) | +------------------+-----------------------------------------------+-------------------------+ | MySQL | Web apps, CMS, e-commerce | Mid-tier to lightweight | +------------------+-----------------------------------------------+-------------------------+ | PostgreSQL | Analytics, hybrid SQL + NoSQL, data warehouse | Enterprise to mid-tier | +------------------+-----------------------------------------------+-------------------------+ | SQL Server | Microsoft ecosystem, BI, transactional apps | Enterprise (Mid to High)| +------------------+-----------------------------------------------+-------------------------+ | MongoDB | NoSQL, scalable apps, flexible schemas | Mid-tier to startup | +------------------+-----------------------------------------------+-------------------------+ | MariaDB | Web apps, SaaS, e-commerce | Mid-tier | +------------------+-----------------------------------------------+-------------------------+ | SQLite | Mobile apps, embedded systems | Lightweight | +------------------+-----------------------------------------------+-------------------------+

December 3, 2024 · 1 min · 127 words · kidtz