sexta-feira, 14 de outubro de 2022

Oracle Database - Create an Oracle environment for tests with Swingbench

Hello all

Yesterday I needed to build a test environment with Power Protect using DD Boost.

When I have to building an environment for tests, I use Workbench to this.

Below, I put a step by step to build a simple environment.

For this test, I'm create the database IRONMAN with a PDB call IM1.

And just remember, it has worked for me, but it may not work for you.

=================================
== Download Swingbench
=================================
su - oracle 
mkdir Swingbench
cd Swingbench
wget https://www.dominicgiles.com/site_downloads/swingbenchlatest.zip
 
=================================
== Create a TNSNAMES
=================================
vim $ORACLE_HOME/network/admin/tnsnames.ora

IM1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxx.localdomain)(PORT = 1521))
(CONNECT_DATA =
  (SERVER = DEDICATED)
  (SERVICE_NAME = im1)
)
)

=================================
== Restart TNSNAMES
=================================
        -- The script grid.sh create environment variables for grid infrastructure 
source grid.sh
srvctl stop listener
srvctl start listener
srvctl status listener -v

-- The script db.sh create environment variables for database IRONMAN 
source db.sql
sqlplus system/xxx@IM1
=================================
== Create tablespace and user
=================================
alter session set container=IM1;

-- Drop user & tablespace, if exists
DROP USER soe CASCADE;
DROP TABLESPACE SOE INCLUDING CONTENTS AND DATAFILES; 

-- Create a tablespace with Bigfile
CREATE BIGFILE TABLESPACE SOE DATAFILE '+DATA' SIZE 100G AUTOEXTEND ON NEXT 100G MAXSIZE 500G;

-- Create user
CREATE USER soe IDENTIFIED BY Dell123## DEFAULT TABLESPACE soe TEMPORARY TABLESPACE TEMP ACCOUNT UNLOCK;
ALTER USER soe QUOTA UNLIMITED ON soe;
GRANT CREATE SESSION, DBA to soe; 

=================================
== Create REDOs and alter TEMP &
== UNDO, if necessary
=================================
-- Redos
column REDOLOG_FILE_NAME format a50;
set lines 1000
SELECT a.GROUP#, a.THREAD#, a.SEQUENCE#,
   a.ARCHIVED, a.STATUS, b.MEMBER AS REDOLOG_FILE_NAME,
   (a.BYTES/1024/1024) AS SIZE_MB 
FROM v$log a
JOIN v$logfile b ON a.Group#=b.Group#
ORDER BY a.GROUP#;

ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 4 ('+REDO','+REDO') SIZE 1G;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 5 ('+REDO','+REDO') SIZE 1G;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 6 ('+REDO','+REDO') SIZE 1G;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 7 ('+REDO','+REDO') SIZE 1G;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 8 ('+REDO','+REDO') SIZE 1G;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 9 ('+REDO','+REDO') SIZE 1G;
-- Undo 
col T_NAME for a23
col FILE_NAME for a65
SELECT tablespace_name T_NAME,file_name, bytes/1024/1024 MB 
FROM dba_data_files 
WHERE tablespace_name =(SELECT UPPER(value) FROM v$parameter WHERE name = 'undo_tablespace') 
ORDER BY file_name;

--- CDB
SQL> alter database datafile '+DATA/IRONMAN/DATAFILE/undotbs1.258.1107594131' resize 1G;
SQL> alter database datafile '+DATA/IRONMAN/DATAFILE/undotbs1.258.1107594131' autoextend on next 1G maxsize 31G;
SQL> alter tablespace undotbs1 ADD DATAFILE '+DATA' size 1G autoextend on next 512M maxsize 31G;

-- Temp
set pages 999 lines 400
col FILE_NAME format a75
SELECT d.TABLESPACE_NAME, d.FILE_NAME, d.BYTES/1024/1024 SIZE_MB, d.AUTOEXTENSIBLE, d.MAXBYTES/1024/1024 MAXSIZE_MB, d.INCREMENT_BY*(v.BLOCK_SIZE/1024)/1024 INCREMENT_BY_MB
FROM dba_temp_files d, v$tempfile v
WHERE d.FILE_ID = v.FILE#
ORDER BY d.TABLESPACE_NAME, d.FILE_NAME;
--- CDB
SQL> ALTER TABLESPACE temp ADD TEMPFILE '+DATA' SIZE 1G AUTOEXTEND ON NEXT 1G MAXSIZE 31G;
=================================
== Connection test
=================================
conn soe/xxx##@IM1

==================================================================
== Using Swingbench
==================================================================
First, disable archive mode to make the process faster.

cd /home/oracle/Swingbench/swingbench/bin
./shwizard










That's all folks!!!

I hope that help you.

Regards
Mario

Nenhum comentário:

Postar um comentário

Isso te ajudou? Comente...

Postagem em destaque

[ORACLE] Batch change EDITIONABLE property.

Hello everyone. Hope you're doing well! Today, I have a simple case.   A test database had many database objects with the EDITIONABLE pr...