Tuesday, November 27, 2012

How to map a Windows share folder on Linux

- Create the required mount point:

[root@erpapp1 ~]# mkdir /mnt/TimeSheets
[root@erpapp1 ~]#

[root@erpapp1 ~]# cd /mnt/TimeSheets
[root@erpapp1 TimeSheets]#


- Get the UID for the user who will own the shared files:

[root@erpapp1 /]# id apstage1
uid=500(apstage1) gid=54326(dba) groups=54326(dba),54321(oinstall)
[root@erpapp1 /]#



Windows machine: file-server
Windows shared folder: TimeSheets 
Linux mount point: /mnt/TimeSheets
local user (uid=500) will become the owner of the mounted files.


[root@erpapp1 ~]# cat /root/smblogin.txt
username=rsteel/erp.auto
password=ERP112233
[root@erpapp1 ~]# 

where:
Domain Name: rsteel
Windows User Name: erp.auto
Windows user passwd: ERP112233


***********************
***********************
*** Once you mounted the folder, you can remove your password from smblogin.txt
***********************
***********************

[root@erpapp1 mnt]# diff /etc/fstab /etc/fstab_25Nov2012
10d9
\\file-server\TimeSheets /mnt/TimeSheets cifs credentials=/root/smblogin.txt,uid=500,user 0 0
[root@erpapp1 mnt]#


[root@erpapp1 TimeSheets]# mount /mnt/TimeSheets
[root@erpapp1 TimeSheets]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p3      19G   16G  2.9G  85% /
/dev/cciss/c0d0p6     209G  174G   25G  88% /home
/dev/cciss/c0d0p5      15G  4.5G  9.1G  33% /usr
/dev/cciss/c0d0p1      99M   25M   69M  27% /boot
tmpfs                 7.7G   16M  7.7G   1% /dev/shm
//file-server/test    420G  129G  291G  31% /mnt/TimeSheets
[root@erpapp1 TimeSheets]#

[root@erpapp1 TimeSheets]# cd /mnt/TimeSheets
[root@erpapp1 TimeSheets]# ls
setup.msi
[root@erpapp1 TimeSheets]#



Regards,
Mohamed

Friday, November 16, 2012

Recreating Temporary Tablespace

1- Check existing temp tablespaces:

SQL> SELECT tablespace_name, file_name, bytes FROM dba_temp_files;

TABLESPACE_NAME            FILE_NAME                      BYTES
------------------------------ --------------------------------------------- ----------
TEMP1                   /Oracle/TEST/db/apps_st/data/temp01.dbf         2097152000
TEMP2                   /Oracle/TEST/db/apps_st/data/temp02.dbf         2097152000

SQL>

2- Check what is the default Temp Tablespace:


SQL> select PROPERTY_NAME,PROPERTY_VALUE from database_properties where property_name like '%TEMP%';

PROPERTY_NAME               PROPERTY_VALUE
------------------------------ ------------------------------
DEFAULT_TEMP_TABLESPACE        TEMP

SQL>

 
- Check if the assigned default tablespace is a tablespace or a temporary tablespace group! in the above example "TEMP" is a temporary tablespace group.

3- Create new Temporary Tablespace Tempo:


SQL> CREATE TEMPORARY TABLESPACE TEMPO TEMPFILE  '/oracle/PROD/db/apps_st/data/tempo.dbf' SIZE 3000M;

4- Change the default Temp Tablespace to be tempo tablespace:


SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE tempo;

5- Drop the old Temporary tablespaces:


> If the old temporary tablespaces are being used by some active sessions, the drop command will hang till the sessions that using those tablespaces were stopped:

-  Check the session that is currently use temporary tablespaces V$SORT_USAGE:

SQL> SELECT USERNAME,SESSION_NUM,TABLESPACE FROM V$SORT_USAGE;

-  If you decided to kill those sessions then you can do the following:

a) SQL> SELECT SID, SERIAL#, STATUS,STATE FROM V$SESSION WHERE SERIAL#=&SESSION_NUM;

b) Terminate unwanted sessions:
 
 SQL> ALTER SYSTEM KILL 'SID,SERIAL#';

c) Drop temp tablespace

SQL> DROP TABLESPACE temp1 INCLUDING CONTENTS AND DATAFILES;SQL> DROP TABLESPACE temp2 INCLUDING CONTENTS AND DATAFILES;

6- Recreate Temporary Tablespaces:


SQL> CREATE TEMPORARY TABLESPACE TEMP1 TEMPFILE '/oracle/PROD/db/apps_st/data/temp01.dbf' SIZE 6000M AUTOEXTEND ON NEXT 100M MAXSIZE unlimited EXTENT MANAGEMENT LOCAL;
 
SQL> CREATE TEMPORARY TABLESPACE TEMP2 TEMPFILE '/oracle/PROD/db/apps_st/data/temp02.dbf' SIZE 6000M AUTOEXTEND ON NEXT 100M MAXSIZE unlimited EXTENT MANAGEMENT LOCAL;

7- Add the Tablespaces to a temporary tablespace group


SQL> ALTER TEMPORARY TABLESPACE temp1 TABLESPACE GROUP TEMP;SQL> ALTER TEMPORARY TABLESPACE temp2 TABLESPACE GROUP TEMP;

- Check that both tablespaces were assigned to the group:
SQL> select * from DBA_TABLESPACE_GROUPS;

- If you need to remove the tablespace from the group use:
SQL> ALTER TEMPORARY TABLESPACE temp1 TABLESPACE GROUP '';

8- Change the default tablespace back again to it's original value:


SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp;

9- Drop the tempo tablespace:

SQL> DROP TABLESPACE tempo INCLUDING CONTENTS AND DATAFILES;

Regards,
Mohamed