diff --git a/castor/db/cnv/DbSvcClassCnv.cpp b/castor/db/cnv/DbSvcClassCnv.cpp
index e18a4c8f40c49cb27c849d5dabbaef7c01b33380..bf9c8fbf43645126b3b8261a4b56785e9501f8a5 100644
--- a/castor/db/cnv/DbSvcClassCnv.cpp
+++ b/castor/db/cnv/DbSvcClassCnv.cpp
@@ -53,11 +53,11 @@ static castor::CnvFactory<castor::db::cnv::DbSvcClassCnv>* s_factoryDbSvcClassCn
 //------------------------------------------------------------------------------
 /// SQL statement for request insertion
 const std::string castor::db::cnv::DbSvcClassCnv::s_insertStatementString =
-"INSERT INTO SvcClass (name, defaultFileSize, maxReplicaNb, gcPolicy, disk1Behavior, replicateOnClose, failJobsWhenNoSpace, lastEditor, lastEditionTime, id, forcedFileClass) VALUES (:1,:2,:3,:4,:5,:6,:7,:8,:9,ids_seq.nextval,:10) RETURNING id INTO :11";
+"INSERT INTO SvcClass (name, defaultFileSize, replicaNb, gcPolicy, disk1Behavior, failJobsWhenNoSpace, lastEditor, lastEditionTime, id, forcedFileClass) VALUES (:1,:2,:3,:4,:5,:6,:7,:8,ids_seq.nextval,:9) RETURNING id INTO :10";
 
 /// SQL statement for request bulk insertion
 const std::string castor::db::cnv::DbSvcClassCnv::s_bulkInsertStatementString =
-"INSERT /* bulk */ INTO SvcClass (name, defaultFileSize, maxReplicaNb, gcPolicy, disk1Behavior, replicateOnClose, failJobsWhenNoSpace, lastEditor, lastEditionTime, id, forcedFileClass) VALUES (:1,:2,:3,:4,:5,:6,:7,:8,:9,ids_seq.nextval,:10) RETURNING id INTO :11";
+"INSERT /* bulk */ INTO SvcClass (name, defaultFileSize, replicaNb, gcPolicy, disk1Behavior, failJobsWhenNoSpace, lastEditor, lastEditionTime, id, forcedFileClass) VALUES (:1,:2,:3,:4,:5,:6,:7,:8,ids_seq.nextval,:9) RETURNING id INTO :10";
 
 /// SQL statement for request deletion
 const std::string castor::db::cnv::DbSvcClassCnv::s_deleteStatementString =
@@ -65,19 +65,19 @@ const std::string castor::db::cnv::DbSvcClassCnv::s_deleteStatementString =
 
 /// SQL statement for request selection
 const std::string castor::db::cnv::DbSvcClassCnv::s_selectStatementString =
-"SELECT name, defaultFileSize, maxReplicaNb, gcPolicy, disk1Behavior, replicateOnClose, failJobsWhenNoSpace, lastEditor, lastEditionTime, id, forcedFileClass FROM SvcClass WHERE id = :1";
+"SELECT name, defaultFileSize, replicaNb, gcPolicy, disk1Behavior, failJobsWhenNoSpace, lastEditor, lastEditionTime, id, forcedFileClass FROM SvcClass WHERE id = :1";
 
 /// SQL statement for bulk request selection
 const std::string castor::db::cnv::DbSvcClassCnv::s_bulkSelectStatementString =
 "DECLARE \
-   TYPE RecordType IS RECORD (name VARCHAR2(2048), defaultFileSize INTEGER, maxReplicaNb NUMBER, gcPolicy VARCHAR2(2048), disk1Behavior NUMBER, replicateOnClose NUMBER, failJobsWhenNoSpace NUMBER, lastEditor VARCHAR2(2048), lastEditionTime INTEGER, id INTEGER, forcedFileClass INTEGER); \
+   TYPE RecordType IS RECORD (name VARCHAR2(2048), defaultFileSize INTEGER, replicaNb NUMBER, gcPolicy VARCHAR2(2048), disk1Behavior NUMBER, failJobsWhenNoSpace NUMBER, lastEditor VARCHAR2(2048), lastEditionTime INTEGER, id INTEGER, forcedFileClass INTEGER); \
    TYPE CurType IS REF CURSOR RETURN RecordType; \
    PROCEDURE bulkSelect(ids IN castor.\"cnumList\", \
                         objs OUT CurType) AS \
    BEGIN \
      FORALL i IN ids.FIRST..ids.LAST \
        INSERT INTO bulkSelectHelper VALUES(ids(i)); \
-     OPEN objs FOR SELECT name, defaultFileSize, maxReplicaNb, gcPolicy, disk1Behavior, replicateOnClose, failJobsWhenNoSpace, lastEditor, lastEditionTime, id, forcedFileClass \
+     OPEN objs FOR SELECT name, defaultFileSize, replicaNb, gcPolicy, disk1Behavior, failJobsWhenNoSpace, lastEditor, lastEditionTime, id, forcedFileClass \
                      FROM SvcClass t, bulkSelectHelper h \
                     WHERE t.id = h.objId; \
      DELETE FROM bulkSelectHelper; \
@@ -88,7 +88,7 @@ const std::string castor::db::cnv::DbSvcClassCnv::s_bulkSelectStatementString =
 
 /// SQL statement for request update
 const std::string castor::db::cnv::DbSvcClassCnv::s_updateStatementString =
-"UPDATE SvcClass SET name = :1, defaultFileSize = :2, maxReplicaNb = :3, gcPolicy = :4, disk1Behavior = :5, replicateOnClose = :6, failJobsWhenNoSpace = :7, lastEditor = :8, lastEditionTime = :9 WHERE id = :10";
+"UPDATE SvcClass SET name = :1, defaultFileSize = :2, replicaNb = :3, gcPolicy = :4, disk1Behavior = :5, failJobsWhenNoSpace = :6, lastEditor = :7, lastEditionTime = :8 WHERE id = :9";
 
 /// SQL existence statement for member forcedFileClass
 const std::string castor::db::cnv::DbSvcClassCnv::s_checkFileClassExistStatementString =
@@ -252,7 +252,7 @@ void castor::db::cnv::DbSvcClassCnv::fillObjFileClass(castor::stager::SvcClass*
     ex.getMessage() << "No object found for id :" << obj->id();
     throw ex;
   }
-  u_signed64 forcedFileClassId = rset->getInt64(11);
+  u_signed64 forcedFileClassId = rset->getInt64(10);
   // Close ResultSet
   delete rset;
   // Check whether something should be deleted
@@ -290,21 +290,20 @@ void castor::db::cnv::DbSvcClassCnv::createRep(castor::IAddress*,
     // Check whether the statements are ok
     if (0 == m_insertStatement) {
       m_insertStatement = createStatement(s_insertStatementString);
-      m_insertStatement->registerOutParam(11, castor::db::DBTYPE_UINT64);
+      m_insertStatement->registerOutParam(10, castor::db::DBTYPE_UINT64);
     }
     // Now Save the current object
     m_insertStatement->setString(1, obj->name());
     m_insertStatement->setUInt64(2, obj->defaultFileSize());
-    m_insertStatement->setInt(3, obj->maxReplicaNb());
+    m_insertStatement->setInt(3, obj->replicaNb());
     m_insertStatement->setString(4, obj->gcPolicy());
     m_insertStatement->setInt(5, obj->disk1Behavior());
-    m_insertStatement->setInt(6, obj->replicateOnClose());
-    m_insertStatement->setInt(7, obj->failJobsWhenNoSpace());
-    m_insertStatement->setString(8, obj->lastEditor());
-    m_insertStatement->setUInt64(9, obj->lastEditionTime());
-    m_insertStatement->setUInt64(10, (type == OBJ_FileClass && obj->forcedFileClass() != 0) ? obj->forcedFileClass()->id() : 0);
+    m_insertStatement->setInt(6, obj->failJobsWhenNoSpace());
+    m_insertStatement->setString(7, obj->lastEditor());
+    m_insertStatement->setUInt64(8, obj->lastEditionTime());
+    m_insertStatement->setUInt64(9, (type == OBJ_FileClass && obj->forcedFileClass() != 0) ? obj->forcedFileClass()->id() : 0);
     m_insertStatement->execute();
-    obj->setId(m_insertStatement->getUInt64(11));
+    obj->setId(m_insertStatement->getUInt64(10));
     if (endTransaction) {
       cnvSvc()->commit();
     }
@@ -321,10 +320,9 @@ void castor::db::cnv::DbSvcClassCnv::createRep(castor::IAddress*,
                     << " and parameters' values were :" << std::endl
                     << "  name : " << obj->name() << std::endl
                     << "  defaultFileSize : " << obj->defaultFileSize() << std::endl
-                    << "  maxReplicaNb : " << obj->maxReplicaNb() << std::endl
+                    << "  replicaNb : " << obj->replicaNb() << std::endl
                     << "  gcPolicy : " << obj->gcPolicy() << std::endl
                     << "  disk1Behavior : " << obj->disk1Behavior() << std::endl
-                    << "  replicateOnClose : " << obj->replicateOnClose() << std::endl
                     << "  failJobsWhenNoSpace : " << obj->failJobsWhenNoSpace() << std::endl
                     << "  lastEditor : " << obj->lastEditor() << std::endl
                     << "  lastEditionTime : " << obj->lastEditionTime() << std::endl
@@ -355,7 +353,7 @@ void castor::db::cnv::DbSvcClassCnv::bulkCreateRep(castor::IAddress*,
     // Check whether the statements are ok
     if (0 == m_bulkInsertStatement) {
       m_bulkInsertStatement = createStatement(s_bulkInsertStatementString);
-      m_bulkInsertStatement->registerOutParam(11, castor::db::DBTYPE_UINT64);
+      m_bulkInsertStatement->registerOutParam(10, castor::db::DBTYPE_UINT64);
     }
     // build the buffers for name
     unsigned int nameMaxLen = 0;
@@ -400,25 +398,25 @@ void castor::db::cnv::DbSvcClassCnv::bulkCreateRep(castor::IAddress*,
     }
     m_bulkInsertStatement->setDataBuffer
       (2, defaultFileSizeBuffer, castor::db::DBTYPE_UINT64, sizeof(defaultFileSizeBuffer[0]), defaultFileSizeBufLens);
-    // build the buffers for maxReplicaNb
-    int* maxReplicaNbBuffer = (int*) malloc(nb * sizeof(int));
-    if (maxReplicaNbBuffer == 0) {
+    // build the buffers for replicaNb
+    int* replicaNbBuffer = (int*) malloc(nb * sizeof(int));
+    if (replicaNbBuffer == 0) {
       castor::exception::OutOfMemory e;
       throw e;
     }
-    allocMem.push_back(maxReplicaNbBuffer);
-    unsigned short* maxReplicaNbBufLens = (unsigned short*) malloc(nb * sizeof(unsigned short));
-    if (maxReplicaNbBufLens == 0) {
+    allocMem.push_back(replicaNbBuffer);
+    unsigned short* replicaNbBufLens = (unsigned short*) malloc(nb * sizeof(unsigned short));
+    if (replicaNbBufLens == 0) {
       castor::exception::OutOfMemory e;
       throw e;
     }
-    allocMem.push_back(maxReplicaNbBufLens);
+    allocMem.push_back(replicaNbBufLens);
     for (int i = 0; i < nb; i++) {
-      maxReplicaNbBuffer[i] = objs[i]->maxReplicaNb();
-      maxReplicaNbBufLens[i] = sizeof(int);
+      replicaNbBuffer[i] = objs[i]->replicaNb();
+      replicaNbBufLens[i] = sizeof(int);
     }
     m_bulkInsertStatement->setDataBuffer
-      (3, maxReplicaNbBuffer, castor::db::DBTYPE_INT, sizeof(maxReplicaNbBuffer[0]), maxReplicaNbBufLens);
+      (3, replicaNbBuffer, castor::db::DBTYPE_INT, sizeof(replicaNbBuffer[0]), replicaNbBufLens);
     // build the buffers for gcPolicy
     unsigned int gcPolicyMaxLen = 0;
     for (int i = 0; i < nb; i++) {
@@ -462,25 +460,6 @@ void castor::db::cnv::DbSvcClassCnv::bulkCreateRep(castor::IAddress*,
     }
     m_bulkInsertStatement->setDataBuffer
       (5, disk1BehaviorBuffer, castor::db::DBTYPE_INT, sizeof(disk1BehaviorBuffer[0]), disk1BehaviorBufLens);
-    // build the buffers for replicateOnClose
-    bool* replicateOnCloseBuffer = (bool*) malloc(nb * sizeof(bool));
-    if (replicateOnCloseBuffer == 0) {
-      castor::exception::OutOfMemory e;
-      throw e;
-    }
-    allocMem.push_back(replicateOnCloseBuffer);
-    unsigned short* replicateOnCloseBufLens = (unsigned short*) malloc(nb * sizeof(unsigned short));
-    if (replicateOnCloseBufLens == 0) {
-      castor::exception::OutOfMemory e;
-      throw e;
-    }
-    allocMem.push_back(replicateOnCloseBufLens);
-    for (int i = 0; i < nb; i++) {
-      replicateOnCloseBuffer[i] = objs[i]->replicateOnClose();
-      replicateOnCloseBufLens[i] = sizeof(bool);
-    }
-    m_bulkInsertStatement->setDataBuffer
-      (6, replicateOnCloseBuffer, castor::db::DBTYPE_INT, sizeof(replicateOnCloseBuffer[0]), replicateOnCloseBufLens);
     // build the buffers for failJobsWhenNoSpace
     bool* failJobsWhenNoSpaceBuffer = (bool*) malloc(nb * sizeof(bool));
     if (failJobsWhenNoSpaceBuffer == 0) {
@@ -499,7 +478,7 @@ void castor::db::cnv::DbSvcClassCnv::bulkCreateRep(castor::IAddress*,
       failJobsWhenNoSpaceBufLens[i] = sizeof(bool);
     }
     m_bulkInsertStatement->setDataBuffer
-      (7, failJobsWhenNoSpaceBuffer, castor::db::DBTYPE_INT, sizeof(failJobsWhenNoSpaceBuffer[0]), failJobsWhenNoSpaceBufLens);
+      (6, failJobsWhenNoSpaceBuffer, castor::db::DBTYPE_INT, sizeof(failJobsWhenNoSpaceBuffer[0]), failJobsWhenNoSpaceBufLens);
     // build the buffers for lastEditor
     unsigned int lastEditorMaxLen = 0;
     for (int i = 0; i < nb; i++) {
@@ -523,7 +502,7 @@ void castor::db::cnv::DbSvcClassCnv::bulkCreateRep(castor::IAddress*,
       lastEditorBufLens[i] = objs[i]->lastEditor().length()+1; // + 1 for the trailing \0
     }
     m_bulkInsertStatement->setDataBuffer
-      (8, lastEditorBuffer, castor::db::DBTYPE_STRING, lastEditorMaxLen, lastEditorBufLens);
+      (7, lastEditorBuffer, castor::db::DBTYPE_STRING, lastEditorMaxLen, lastEditorBufLens);
     // build the buffers for lastEditionTime
     double* lastEditionTimeBuffer = (double*) malloc(nb * sizeof(double));
     if (lastEditionTimeBuffer == 0) {
@@ -542,7 +521,7 @@ void castor::db::cnv::DbSvcClassCnv::bulkCreateRep(castor::IAddress*,
       lastEditionTimeBufLens[i] = sizeof(double);
     }
     m_bulkInsertStatement->setDataBuffer
-      (9, lastEditionTimeBuffer, castor::db::DBTYPE_UINT64, sizeof(lastEditionTimeBuffer[0]), lastEditionTimeBufLens);
+      (8, lastEditionTimeBuffer, castor::db::DBTYPE_UINT64, sizeof(lastEditionTimeBuffer[0]), lastEditionTimeBufLens);
     // build the buffers for forcedFileClass
     double* forcedFileClassBuffer = (double*) malloc(nb * sizeof(double));
     if (forcedFileClassBuffer == 0) {
@@ -561,7 +540,7 @@ void castor::db::cnv::DbSvcClassCnv::bulkCreateRep(castor::IAddress*,
       forcedFileClassBufLens[i] = sizeof(double);
     }
     m_bulkInsertStatement->setDataBuffer
-      (10, forcedFileClassBuffer, castor::db::DBTYPE_UINT64, sizeof(forcedFileClassBuffer[0]), forcedFileClassBufLens);
+      (9, forcedFileClassBuffer, castor::db::DBTYPE_UINT64, sizeof(forcedFileClassBuffer[0]), forcedFileClassBufLens);
     // build the buffers for returned ids
     double* idBuffer = (double*) calloc(nb, sizeof(double));
     if (idBuffer == 0) {
@@ -576,7 +555,7 @@ void castor::db::cnv::DbSvcClassCnv::bulkCreateRep(castor::IAddress*,
     }
     allocMem.push_back(idBufLens);
     m_bulkInsertStatement->setDataBuffer
-      (11, idBuffer, castor::db::DBTYPE_UINT64, sizeof(double), idBufLens);
+      (10, idBuffer, castor::db::DBTYPE_UINT64, sizeof(double), idBufLens);
     m_bulkInsertStatement->execute(nb);
     for (int i = 0; i < nb; i++) {
       objects[i]->setId((u_signed64)idBuffer[i]);
@@ -625,14 +604,13 @@ void castor::db::cnv::DbSvcClassCnv::updateRep(castor::IAddress*,
     // Update the current object
     m_updateStatement->setString(1, obj->name());
     m_updateStatement->setUInt64(2, obj->defaultFileSize());
-    m_updateStatement->setInt(3, obj->maxReplicaNb());
+    m_updateStatement->setInt(3, obj->replicaNb());
     m_updateStatement->setString(4, obj->gcPolicy());
     m_updateStatement->setInt(5, obj->disk1Behavior());
-    m_updateStatement->setInt(6, obj->replicateOnClose());
-    m_updateStatement->setInt(7, obj->failJobsWhenNoSpace());
-    m_updateStatement->setString(8, obj->lastEditor());
-    m_updateStatement->setUInt64(9, obj->lastEditionTime());
-    m_updateStatement->setUInt64(10, obj->id());
+    m_updateStatement->setInt(6, obj->failJobsWhenNoSpace());
+    m_updateStatement->setString(7, obj->lastEditor());
+    m_updateStatement->setUInt64(8, obj->lastEditionTime());
+    m_updateStatement->setUInt64(9, obj->id());
     m_updateStatement->execute();
     if (endTransaction) {
       cnvSvc()->commit();
@@ -714,14 +692,13 @@ castor::IObject* castor::db::cnv::DbSvcClassCnv::createObj(castor::IAddress* add
     // Now retrieve and set members
     object->setName(rset->getString(1));
     object->setDefaultFileSize(rset->getUInt64(2));
-    object->setMaxReplicaNb(rset->getInt(3));
+    object->setReplicaNb(rset->getInt(3));
     object->setGcPolicy(rset->getString(4));
     object->setDisk1Behavior(rset->getInt(5));
-    object->setReplicateOnClose(rset->getInt(6));
-    object->setFailJobsWhenNoSpace(rset->getInt(7));
-    object->setLastEditor(rset->getString(8));
-    object->setLastEditionTime(rset->getUInt64(9));
-    object->setId(rset->getUInt64(10));
+    object->setFailJobsWhenNoSpace(rset->getInt(6));
+    object->setLastEditor(rset->getString(7));
+    object->setLastEditionTime(rset->getUInt64(8));
+    object->setId(rset->getUInt64(9));
     delete rset;
     return object;
   } catch (castor::exception::SQLError& e) {
@@ -769,14 +746,13 @@ castor::db::cnv::DbSvcClassCnv::bulkCreateObj(castor::IAddress* address)
       // Now retrieve and set members
       object->setName(rset->getString(1));
       object->setDefaultFileSize(rset->getUInt64(2));
-      object->setMaxReplicaNb(rset->getInt(3));
+      object->setReplicaNb(rset->getInt(3));
       object->setGcPolicy(rset->getString(4));
       object->setDisk1Behavior(rset->getInt(5));
-      object->setReplicateOnClose(rset->getInt(6));
-      object->setFailJobsWhenNoSpace(rset->getInt(7));
-      object->setLastEditor(rset->getString(8));
-      object->setLastEditionTime(rset->getUInt64(9));
-      object->setId(rset->getUInt64(10));
+      object->setFailJobsWhenNoSpace(rset->getInt(6));
+      object->setLastEditor(rset->getString(7));
+      object->setLastEditionTime(rset->getUInt64(8));
+      object->setId(rset->getUInt64(9));
       // store object in results and loop;
       res.push_back(object);
       status = rset->next();
@@ -816,14 +792,13 @@ void castor::db::cnv::DbSvcClassCnv::updateObj(castor::IObject* obj)
       dynamic_cast<castor::stager::SvcClass*>(obj);
     object->setName(rset->getString(1));
     object->setDefaultFileSize(rset->getUInt64(2));
-    object->setMaxReplicaNb(rset->getInt(3));
+    object->setReplicaNb(rset->getInt(3));
     object->setGcPolicy(rset->getString(4));
     object->setDisk1Behavior(rset->getInt(5));
-    object->setReplicateOnClose(rset->getInt(6));
-    object->setFailJobsWhenNoSpace(rset->getInt(7));
-    object->setLastEditor(rset->getString(8));
-    object->setLastEditionTime(rset->getUInt64(9));
-    object->setId(rset->getUInt64(10));
+    object->setFailJobsWhenNoSpace(rset->getInt(6));
+    object->setLastEditor(rset->getString(7));
+    object->setLastEditionTime(rset->getUInt64(8));
+    object->setId(rset->getUInt64(9));
     delete rset;
   } catch (castor::exception::SQLError& e) {
     castor::exception::InvalidArgument ex;
diff --git a/castor/db/oracleCommon.schema.sql b/castor/db/oracleCommon.schema.sql
index 2e67ee8714c8ca203b67834cdf2ae70da03b1537..6d77b8dfe97069b1b6976497ea90087e33d88e29 100644
--- a/castor/db/oracleCommon.schema.sql
+++ b/castor/db/oracleCommon.schema.sql
@@ -298,10 +298,9 @@ INSERT INTO GcPolicy VALUES ('LRUpin',
 /* SQL statements for type SvcClass */
 CREATE TABLE SvcClass (name VARCHAR2(2048) CONSTRAINT NN_SvcClass_Name NOT NULL,
                        defaultFileSize INTEGER,
-                       maxReplicaNb NUMBER,
+                       replicaNb NUMBER,
                        gcPolicy VARCHAR2(2048) DEFAULT 'default' CONSTRAINT NN_SvcClass_GcPolicy NOT NULL,
                        disk1Behavior NUMBER,
-                       replicateOnClose NUMBER,
                        failJobsWhenNoSpace NUMBER,
                        lastEditor VARCHAR2(2048) CONSTRAINT NN_SvcClass_LastEditor NOT NULL,
                        lastEditionTime INTEGER CONSTRAINT NN_SvcClass_LastEditionTime NOT NULL,
diff --git a/castor/db/oracleJob.sql b/castor/db/oracleJob.sql
index 72026f98f44d4dfae16c23aec3963bb29c063bd6..6cf2d7d0440d432d89f36cff958697848cc4d2bc 100644
--- a/castor/db/oracleJob.sql
+++ b/castor/db/oracleJob.sql
@@ -601,7 +601,7 @@ BEGIN
         UPDATE DiskCopy SET importance = varDCImportance WHERE castorFile = varCfId;
       END IF;
       -- trigger the creation of additional copies of the file, if any
-      replicateOnClose(varCfId, varUid, varGid);
+      replicateOnClose(varCfId, varUid, varGid, varDestSvcClass);
     END IF;
   ELSE
     -- failure
@@ -1049,7 +1049,8 @@ BEGIN
              AND FileSystem.status IN (dconst.FILESYSTEM_PRODUCTION, dconst.FILESYSTEM_DRAINING, dconst.FILESYSTEM_READONLY)
              AND DiskServer.hwOnline = 1
            UNION
-          SELECT DiskServer.name || ':' AS candidate
+          SELECT /*+ INDEX_RS_ASC(DiskCopy I_DiskCopy_Castorfile) */ 
+                 DiskServer.name || ':' AS candidate
             FROM DiskServer, DiskCopy
            WHERE DiskCopy.castorFile = inCfId
              AND DiskCopy.status = dconst.DISKCOPY_VALID
diff --git a/castor/db/oracleStager.sql b/castor/db/oracleStager.sql
index 73904b8ebb29201026c80dc6d0ff2950ba910035..df59b23983718ca3cd6b08c11425bfb09a81dd5a 100644
--- a/castor/db/oracleStager.sql
+++ b/castor/db/oracleStager.sql
@@ -245,7 +245,7 @@ END;
 /
 
 
-/* This procedure is used to check if the maxReplicaNb has been exceeded
+/* This procedure is used to check if the replicaNb has been exceeded
  * for some CastorFiles. It checks all the files listed in TooManyReplicasHelper
  * This is called from a DB job and is fed by the tr_DiskCopy_Created trigger
  * on creation of new diskcopies
@@ -253,7 +253,7 @@ END;
 CREATE OR REPLACE PROCEDURE checkNbReplicas AS
   varSvcClassId INTEGER;
   varCfId INTEGER;
-  varMaxReplicaNb NUMBER;
+  varReplicaNb NUMBER;
   varNbFiles NUMBER;
   varDidSth BOOLEAN;
 BEGIN
@@ -271,7 +271,7 @@ BEGIN
     SELECT id INTO varCfId FROM CastorFile
      WHERE id = varCfId FOR UPDATE;
     -- Get the max replica number of the service class
-    SELECT maxReplicaNb INTO varMaxReplicaNb
+    SELECT replicaNb INTO varReplicaNb
       FROM SvcClass WHERE id = varSvcClassId;
     -- Produce a list of diskcopies to invalidate should too many replicas be online.
     varDidSth := False;
@@ -302,7 +302,7 @@ BEGIN
                        AND DiskCopy.status = dconst.DISKCOPY_VALID)
                    -- Select non-PRODUCTION hardware first
                    ORDER BY decode(fsStatus, 0, decode(dsStatus, 0, 0, 1), 1) ASC, gcWeight DESC))
-               WHERE ind > varMaxReplicaNb)
+               WHERE ind > varReplicaNb)
     LOOP
       -- Sanity check, make sure that the last copy is never dropped!
       SELECT /*+ INDEX_RS_ASC(DiskCopy I_DiskCopy_CastorFile) */ count(*) INTO varNbFiles
@@ -1725,52 +1725,51 @@ END;
 /
 
 /* PL/SQL method implementing replicateOnClose */
-CREATE OR REPLACE PROCEDURE replicateOnClose(cfId IN NUMBER, ouid IN INTEGER, ogid IN INTEGER) AS
+CREATE OR REPLACE PROCEDURE replicateOnClose(inCfId IN INTEGER,
+                                             inUid IN INTEGER,
+                                             inGid IN INTEGER,
+                                             inSvcClassId IN INTEGER) AS
   varNsOpenTime NUMBER;
-  srcSvcClassId NUMBER;
-  ignoreSvcClass NUMBER;
+  varNbCopies INTEGER;
+  varExpectedNbCopies INTEGER;
 BEGIN
   -- Lock the castorfile and take the nsOpenTime
-  SELECT nsOpenTime INTO varNsOpenTime FROM CastorFile WHERE id = cfId FOR UPDATE;
-  -- Loop over all service classes where replication is required
-  FOR a IN (SELECT SvcClass.id FROM (
-              -- Determine the number of copies of the file in all service classes
-              SELECT * FROM (
-                SELECT child, sum(available) AS available FROM (
-                  SELECT  /*+ INDEX_RS_ASC(DiskCopy I_DiskCopy_CastorFile) */
-                         DiskPool2SvcClass.child, 1 available
-                    FROM DiskCopy, FileSystem, DiskServer, DiskPool2SvcClass
-                   WHERE DiskCopy.filesystem = FileSystem.id
-                     AND DiskCopy.castorfile = cfId
-                     AND FileSystem.diskpool = DiskPool2SvcClass.parent
-                     AND DiskCopy.status = dconst.DISKCOPY_VALID
-                     AND FileSystem.status IN
-                         (dconst.FILESYSTEM_PRODUCTION, dconst.FILESYSTEM_DRAINING, dconst.FILESYSTEM_READONLY)
-                     AND DiskServer.id = FileSystem.diskserver
-                     AND DiskServer.status IN
-                         (dconst.DISKSERVER_PRODUCTION, dconst.DISKSERVER_DRAINING, dconst.DISKSERVER_READONLY)
-                   UNION ALL
-                  SELECT  /*+ INDEX_RS_ASC(DiskCopy I_DiskCopy_CastorFile) */
-                         DataPool2SvcClass.child, 1 available
-                    FROM DiskCopy, DataPool2SvcClass
-                   WHERE DiskCopy.castorfile = cfId
-                     AND DiskCopy.status = dconst.DISKCOPY_VALID
-                     AND DiskCopy.dataPool = DataPool2SvcClass.parent
-                     AND EXISTS (SELECT 1 FROM DiskServer
-                                  WHERE DiskServer.dataPool = DiskCopy.dataPool
-                                    AND DiskServer.status IN (dconst.DISKSERVER_PRODUCTION,
-                                                              dconst.DISKSERVER_DRAINING,
-                                                              dconst.DISKSERVER_READONLY)))
-                 GROUP by child)) results, SvcClass
-             -- Join the results with the service class table and determine if
-             -- additional copies need to be created
-             WHERE results.child = SvcClass.id
-               AND SvcClass.replicateOnClose = 1
-               AND results.available < SvcClass.maxReplicaNb)
-  LOOP
+  SELECT nsOpenTime INTO varNsOpenTime FROM CastorFile WHERE id = inCfId FOR UPDATE;
+  -- Determine the number of copies of the file in the given service class
+  SELECT count(*) INTO varNbCopies FROM (
+    SELECT /*+ INDEX_RS_ASC(DiskCopy I_DiskCopy_CastorFile) */ 1
+      FROM DiskCopy, FileSystem, DiskServer, DiskPool2SvcClass
+     WHERE DiskCopy.castorfile = inCfId
+       AND FileSystem.id = DiskCopy.filesystem
+       AND DiskServer.id = FileSystem.diskserver
+       AND DiskPool2SvcClass.parent = FileSystem.diskpool
+       AND DiskPool2SvcClass.child = inSvcClassId
+       AND DiskCopy.status = dconst.DISKCOPY_VALID
+       AND FileSystem.status IN (dconst.FILESYSTEM_PRODUCTION,
+                                 dconst.FILESYSTEM_DRAINING,
+                                 dconst.FILESYSTEM_READONLY)
+       AND DiskServer.status IN (dconst.DISKSERVER_PRODUCTION,
+                                 dconst.DISKSERVER_DRAINING,
+                                 dconst.DISKSERVER_READONLY)
+     UNION ALL
+    SELECT /*+ INDEX_RS_ASC(DiskCopy I_DiskCopy_CastorFile) */ 1
+      FROM DiskCopy, DataPool2SvcClass
+     WHERE DiskCopy.castorfile = inCfId
+       AND DiskCopy.status = dconst.DISKCOPY_VALID
+       AND DataPool2SvcClass.parent = DiskCopy.dataPool
+       AND DataPool2SvcClass.child = inSvcClassId
+       AND EXISTS (SELECT 1 FROM DiskServer
+                    WHERE DiskServer.dataPool = DiskCopy.dataPool
+                      AND DiskServer.status IN (dconst.DISKSERVER_PRODUCTION,
+                                                dconst.DISKSERVER_DRAINING,
+                                                dconst.DISKSERVER_READONLY)));
+  -- Determine expected number of copies
+  SELECT replicaNb INTO varExpectedNbCopies FROM SvcClass WHERE id = inSvcClassId;
+  -- Trigger additional copies if needed
+  FOR varI IN (varNbCopies+1)..varExpectedNbCopies LOOP
     BEGIN
       -- Trigger a replication request.
-      createDisk2DiskCopyJob(cfId, varNsOpenTime, a.id, ouid, ogid, dconst.REPLICATIONTYPE_USER, NULL, FALSE, NULL, TRUE);
+      createDisk2DiskCopyJob(inCfId, varNsOpenTime, inSvcClassId, inUid, inGid, dconst.REPLICATIONTYPE_USER, NULL, FALSE, NULL, TRUE);
     EXCEPTION WHEN NO_DATA_FOUND THEN
       NULL;  -- No copies to replicate from
     END;
@@ -1778,7 +1777,6 @@ BEGIN
 END;
 /
 
-
 /*** initMigration ***/
 CREATE OR REPLACE PROCEDURE initMigration
 (cfId IN INTEGER, datasize IN INTEGER, originalVID IN VARCHAR2,
@@ -1865,7 +1863,7 @@ BEGIN
     END;
   END IF;
   -- Trigger the creation of additional copies of the file, if necessary.
-  replicateOnClose(cfId, ouid, ogid);
+  replicateOnClose(cfId, ouid, ogid, svcClassId);
 END;
 /
 
@@ -2890,6 +2888,58 @@ BEGIN
 END;
 /
 
+CREATE OR REPLACE PROCEDURE handleReplication(inFileId IN INTEGER,
+                                              inNsHost IN VARCHAR2,
+                                              inCfId IN INTEGER,
+                                              inNsOpenTime IN INTEGER,
+                                              inSvcClassId IN INTEGER,
+                                              inEuid IN INTEGER,
+                                              inEGID IN INTEGER) AS
+  varNbDSs INTEGER;
+BEGIN
+  -- Check that we have a diskserver where to replicate
+  SELECT COUNT(*) INTO varNbDSs FROM (
+    SELECT 1
+      FROM DiskServer, FileSystem, DiskPool2SvcClass
+     WHERE FileSystem.diskServer = DiskServer.id
+       AND FileSystem.diskPool = DiskPool2SvcClass.parent
+       AND DiskPool2SvcClass.child = inSvcClassId
+       AND FileSystem.status = dconst.FILESYSTEM_PRODUCTION
+       AND DiskServer.status = dconst.DISKSERVER_PRODUCTION
+       AND DiskServer.hwOnline = 1
+       AND DiskServer.id NOT IN (
+         SELECT /*+ INDEX(DiskCopy I_DiskCopy_CastorFile) */ DISTINCT(DiskServer.id)
+           FROM DiskCopy, FileSystem, DiskServer
+          WHERE DiskCopy.castorfile = inCfId
+            AND DiskCopy.fileSystem = FileSystem.id
+            AND FileSystem.diskserver = DiskServer.id
+            AND DiskCopy.status = dconst.DISKCOPY_VALID)
+     UNION ALL
+    SELECT 1
+      FROM DiskServer, DataPool2SvcClass
+     WHERE DiskServer.dataPool = DataPool2SvcClass.parent
+       AND DataPool2SvcClass.child = inSvcClassId
+       AND DiskServer.status = dconst.DISKSERVER_PRODUCTION
+       AND DiskServer.hwOnline = 1);
+  IF varNbDSs > 0 THEN
+    BEGIN
+      -- yes, we can replicate, create a replication request without waiting on it.
+      createDisk2DiskCopyJob(inCfId, inNsOpenTime, inSvcClassId, inEuid, inEgid,
+                             dconst.REPLICATIONTYPE_INTERNAL, NULL, FALSE, NULL, FALSE);
+      -- log it
+      logToDLF(NULL, dlf.LVL_SYSTEM, dlf.STAGER_GET_REPLICATION, inFileId, inNsHost, 'stagerd',
+               'svcClassId=' || getSvcClassName(inSvcClassId) ||
+               ' euid=' || TO_CHAR(inEuid) || ' egid=' || TO_CHAR(inEgid));
+    EXCEPTION WHEN NO_DATA_FOUND THEN
+      logToDLF(NULL, dlf.LVL_WARNING, dlf.STAGER_GET_REPLICATION_FAIL, inFileId, inNsHost, 'stagerd',
+               'svcClassId=' || getSvcClassName(inSvcClassId) ||
+               ' euid=' || TO_CHAR(inEuid) || ' egid=' || TO_CHAR(inEgid));
+    END;
+  END IF;
+END;
+/
+
+
 /* PL/SQL method to either force GC of the given diskCopies or delete them when the physical files behind have been lost */
 CREATE OR REPLACE PROCEDURE internalDeleteDiskCopies(inForce IN BOOLEAN,
                                                      inDryRun IN BOOLEAN,
@@ -2901,6 +2951,10 @@ CREATE OR REPLACE PROCEDURE internalDeleteDiskCopies(inForce IN BOOLEAN,
   varStatus INTEGER;
   varLogParams VARCHAR2(2048);
   varFileSize INTEGER;
+  varNsOpenTime NUMBER;
+  varSvcClassId INTEGER;
+  varEuid INTEGER;
+  varEgid INTEGER;
 BEGIN
   -- gather all remote Nameserver statuses. This could not be
   -- incorporated in the INSERT query, because Oracle would give:
@@ -2927,17 +2981,37 @@ BEGIN
   -- when handling large numbers of files (e.g. an entire mount point).
   COMMIT;
   FOR dc IN (SELECT dcId, fileId, fStatus FROM DeleteDiskCopyHelper) LOOP
+    DECLARE
+      varDCFileSystem INTEGER;
+      varDCPool INTEGER;
     BEGIN
       -- get data and lock
-      SELECT castorFile, status, diskCopySize INTO varCfId, varStatus, varFileSize
+      SELECT castorFile, status, diskCopySize, owneruid, ownergid, fileSystem, dataPool
+        INTO varCfId, varStatus, varFileSize, varEuid, varEgid, varDCFileSystem, varDCPool
         FROM DiskCopy
        WHERE DiskCopy.id = dc.dcId;
-      SELECT nsHost, lastKnownFileName INTO varNsHost, varFileName
+      SELECT nsHost, lastKnownFileName, lastUpdateTime INTO varNsHost, varFileName, varNsOpenTime
         FROM CastorFile
        WHERE id = varCfId
          FOR UPDATE;
+      -- get a service class where to put the new copy. Note that we have to choose
+      -- potentially among several and we take randomly the first one. This may cause
+      -- the creation of a new copy of the file in a different place from the lost
+      -- copy, maybe also visible from different service classes in tricky cases.
+      -- However, the essential will be preserved : a second copy will be rebuilt
+      SELECT child INTO varSvcClassId
+        FROM (SELECT DiskPool2SvcClass.child
+                FROM FileSystem, DiskPool2SvcClass
+               WHERE FileSystem.id = varDCFileSystem
+                 AND DiskPool2SvcClass.parent = FileSystem.diskPool
+               UNION ALL
+               SELECT DataPool2SvcClass.child
+                 FROM DataPool2SvcClass
+                WHERE DataPool2SvcClass.parent = varDCPool)
+       WHERE ROWNUM < 2;
       varLogParams := 'FileName="'|| varFileName ||'"" fileSize='|| varFileSize
-        ||' dcId='|| dc.dcId ||' status='|| getObjStatusName('DiskCopy', 'status', varStatus);
+        ||' dcId='|| dc.dcId ||' svcClass=' || varSvcClassId || ', status='
+        || getObjStatusName('DiskCopy', 'status', varStatus);
     EXCEPTION WHEN NO_DATA_FOUND THEN
       -- diskcopy not found in stager
       UPDATE DeleteDiskCopyHelper
@@ -3006,6 +3080,7 @@ BEGIN
         IF NOT inDryRun THEN
           logToDLF(NULL, dlf.LVL_SYSTEM, dlf.DELETEDISKCOPY_REPLICATION,
                    dc.fileId, varNsHost, 'stagerd', varLogParams);
+          handleReplication(dc.fileId, varNsHost, varCfId, varNsOpenTime, varSvcClassId, varEuid, varEgid);
         END IF;
       END IF;
     ELSE
@@ -3029,6 +3104,9 @@ BEGIN
           -- do not forget to cancel pending migrations in case we've lost that last DiskCopy
           IF varNbRemaining = 0 THEN
             deleteMigrationJobs(varCfId);
+          ELSE
+            -- try to recreate lost copy if possible
+            handleReplication(dc.fileId, varNsHost, varCfId, varNsOpenTime, varSvcClassId, varEuid, varEgid);
           END IF;
           logToDLF(NULL, dlf.LVL_SYSTEM, dlf.DELETEDISKCOPY_GC, dc.fileId, varNsHost, 'stagerd', varLogParams);
         END IF;
@@ -3112,99 +3190,6 @@ BEGIN
 END;
 /
 
-/* PL/SQL procedure to handle disk-to-disk copy replication */
-CREATE OR REPLACE PROCEDURE handleReplication(inSRId IN INTEGER, inFileId IN INTEGER,
-                                              inNsHost IN VARCHAR2, inCfId IN INTEGER,
-                                              inNsOpenTime IN INTEGER, inSvcClassId IN INTEGER,
-                                              inEuid IN INTEGER, inEGID IN INTEGER,
-                                              inReqUUID IN VARCHAR2, inSrUUID IN VARCHAR2) AS
-  varUnused INTEGER;
-BEGIN
-  -- check whether there's already an ongoing replication
-  SELECT id INTO varUnused
-    FROM Disk2DiskCopyJob
-   WHERE castorfile = inCfId
-     AND ROWNUM < 2;
-  -- there is an ongoing replication, so just let it go and do nothing more
-EXCEPTION WHEN NO_DATA_FOUND THEN
-  -- no ongoing replication, let's see whether we need to trigger one
-  -- that is compare total current # of diskcopies, regardless hardware availability, against maxReplicaNb
-  DECLARE
-    varNbDCs INTEGER;
-    varMaxDCs INTEGER;
-    varNbDss INTEGER;
-    varDPinvolved INTEGER;
-  BEGIN
-    SELECT COUNT(*), max(maxReplicaNb), sum(isDataPool)
-      INTO varNbDCs, varMaxDCs, varDPinvolved FROM (
-      SELECT /*+ LEADING(DiskCopy FileSystem DiskPool2SvcClass SvcClass)
-                 USE_NL(DiskCopy FileSystem DiskPool2SvcClass SvcClass) */
-             DiskCopy.id, SvcClass.maxReplicaNb, 0 AS isDataPool
-        FROM DiskCopy, FileSystem, DiskPool2SvcClass, SvcClass
-       WHERE DiskCopy.castorfile = inCfId
-         AND DiskCopy.fileSystem = FileSystem.id
-         AND FileSystem.diskpool = DiskPool2SvcClass.parent
-         AND DiskPool2SvcClass.child = SvcClass.id
-         AND SvcClass.id = inSvcClassId
-         AND DiskCopy.status = dconst.DISKCOPY_VALID
-       UNION ALL
-      SELECT /*+ LEADING(DiskCopy DataPool2SvcClass SvcClass)
-                 USE_NL(DiskCopy DataPool2SvcClass SvcClass) */
-             DiskCopy.id, SvcClass.maxReplicaNb, 1 AS isDatapool
-        FROM DiskCopy, DataPool2SvcClass, SvcClass
-       WHERE DiskCopy.castorfile = inCfId
-         AND DiskCopy.dataPool = DataPool2SvcClass.parent
-         AND DataPool2SvcClass.child = SvcClass.id
-         AND SvcClass.id = inSvcClassId
-         AND DiskCopy.status = dconst.DISKCOPY_VALID);
-    IF varNbDCs < varMaxDCs OR varMaxDCs = 0 THEN
-      -- we have to replicate. But in case we have only filesystem based DiskPool,
-      -- we should only do it if we have enough available diskservers
-      -- In case of datapools, we only need one DiskServer available
-      IF varDPinvolved = 0 THEN
-        SELECT COUNT(DISTINCT(DiskServer.name)) INTO varNbDSs
-          FROM DiskServer, FileSystem, DiskPool2SvcClass
-         WHERE FileSystem.diskServer = DiskServer.id
-           AND FileSystem.diskPool = DiskPool2SvcClass.parent
-           AND DiskPool2SvcClass.child = inSvcClassId
-           AND FileSystem.status = dconst.FILESYSTEM_PRODUCTION
-           AND DiskServer.status = dconst.DISKSERVER_PRODUCTION
-           AND DiskServer.hwOnline = 1
-           AND DiskServer.id NOT IN (
-             SELECT /*+ INDEX(DiskCopy I_DiskCopy_CastorFile) */ DISTINCT(DiskServer.id)
-               FROM DiskCopy, FileSystem, DiskServer
-              WHERE DiskCopy.castorfile = inCfId
-                AND DiskCopy.fileSystem = FileSystem.id
-                AND FileSystem.diskserver = DiskServer.id
-                AND DiskCopy.status = dconst.DISKCOPY_VALID);
-      ELSE
-        SELECT COUNT(DISTINCT(DiskServer.name)) INTO varNbDSs
-          FROM DiskServer, DataPool2SvcClass
-         WHERE DiskServer.dataPool = DataPool2SvcClass.parent
-           AND DataPool2SvcClass.child = inSvcClassId
-           AND DiskServer.status = dconst.DISKSERVER_PRODUCTION
-           AND DiskServer.hwOnline = 1;
-      END IF;
-      IF varNbDSs > 0 THEN
-        BEGIN
-          -- yes, we can replicate, create a replication request without waiting on it.
-          createDisk2DiskCopyJob(inCfId, inNsOpenTime, inSvcClassId, inEuid, inEgid,
-                                 dconst.REPLICATIONTYPE_INTERNAL, NULL, FALSE, NULL, FALSE);
-          -- log it
-          logToDLF(inReqUUID, dlf.LVL_SYSTEM, dlf.STAGER_GET_REPLICATION, inFileId, inNsHost, 'stagerd',
-                   'SUBREQID=' || inSrUUID || ' svcClassId=' || getSvcClassName(inSvcClassId) ||
-                   ' euid=' || TO_CHAR(inEuid) || ' egid=' || TO_CHAR(inEgid));
-        EXCEPTION WHEN NO_DATA_FOUND THEN
-          logToDLF(inReqUUID, dlf.LVL_WARNING, dlf.STAGER_GET_REPLICATION_FAIL, inFileId, inNsHost, 'stagerd',
-                   'SUBREQID=' || inSrUUID || ' svcClassId=' || getSvcClassName(inSvcClassId) ||
-                   ' euid=' || TO_CHAR(inEuid) || ' egid=' || TO_CHAR(inEgid));
-        END;
-      END IF;
-    END IF;
-  END;
-END;
-/
-
 /* PL/SQL method implementing triggerD2dOrRecall
  * returns 1 if a recall was successfully triggered
  */
@@ -3657,11 +3642,6 @@ BEGIN
                             AND DiskServer.hwOnline = 1));
   -- first handle the case where we found diskcopies
   IF varNbDCs > 0 THEN
-    -- We may still need to replicate the file (replication on demand)
-    IF varDcStatus != dconst.DISKCOPY_STAGEOUT THEN
-      handleReplication(inSRId, inFileId, inNsHost, inCfId, varNsOpenTime, varSvcClassId,
-                        varEuid, varEgid, varReqUUID, varSrUUID);
-    END IF;
     DECLARE
       varDcList VARCHAR2(2048);
     BEGIN
@@ -3845,9 +3825,6 @@ BEGIN
               'SUBREQID=' || varSrUUID);
       -- update SubRequest
       archiveSubReq(inSrId, dconst.SUBREQUEST_FINISHED);
-      -- last thing, check whether we should recreate missing copies
-      handleReplication(inSrId, inFileId, inNsHost, inCfId, varNsOpenTime, varSvcClassId,
-                        varEuid, varEgid, varReqUUID, varSrUUID);
       -- all went fine, we should answer to client
       RETURN 1;
     END IF;
diff --git a/castor/db/oracleTapeGateway.sql b/castor/db/oracleTapeGateway.sql
index 7ba020f63ba234c9c35e57a90f8297b80018e989..d4d9609d6936bee558283ba4a6150939c19b71fa 100644
--- a/castor/db/oracleTapeGateway.sql
+++ b/castor/db/oracleTapeGateway.sql
@@ -695,7 +695,7 @@ BEGIN
      AND status = dconst.SUBREQUEST_WAITTAPERECALL;
 
   -- trigger the creation of additional copies of the file, if necessary.
-  replicateOnClose(varCfId, varEuid, varEgid);
+  replicateOnClose(varCfId, varEuid, varEgid, varSvcClassId);
 
   -- log success
   logToDLF(inReqId, dlf.LVL_SYSTEM, dlf.RECALL_COMPLETED_DB, varFileId, varNsHost, 'tapegatewayd',
diff --git a/castor/stager/SvcClass.cpp b/castor/stager/SvcClass.cpp
index 7f60544479879ae86b1af93d35b64556ed20e6c3..5c536ce85d0a7585ece8062e050b7d05f5a38f8d 100644
--- a/castor/stager/SvcClass.cpp
+++ b/castor/stager/SvcClass.cpp
@@ -37,10 +37,9 @@
 castor::stager::SvcClass::SvcClass() throw() :
   m_name(""),
   m_defaultFileSize(0),
-  m_maxReplicaNb(0),
+  m_replicaNb(0),
   m_gcPolicy(""),
   m_disk1Behavior(false),
-  m_replicateOnClose(false),
   m_failJobsWhenNoSpace(false),
   m_lastEditor(""),
   m_lastEditionTime(0),
@@ -69,10 +68,9 @@ void castor::stager::SvcClass::print(std::ostream& stream,
   // Output of all members
   stream << indent << "name : " << m_name << std::endl;
   stream << indent << "defaultFileSize : " << m_defaultFileSize << std::endl;
-  stream << indent << "maxReplicaNb : " << m_maxReplicaNb << std::endl;
+  stream << indent << "replicaNb : " << m_replicaNb << std::endl;
   stream << indent << "gcPolicy : " << m_gcPolicy << std::endl;
   stream << indent << "disk1Behavior : " << (m_disk1Behavior ? "Yes" : "No") << std::endl;
-  stream << indent << "replicateOnClose : " << (m_replicateOnClose ? "Yes" : "No") << std::endl;
   stream << indent << "failJobsWhenNoSpace : " << (m_failJobsWhenNoSpace ? "Yes" : "No") << std::endl;
   stream << indent << "lastEditor : " << m_lastEditor << std::endl;
   stream << indent << "lastEditionTime : " << m_lastEditionTime << std::endl;
diff --git a/castor/stager/SvcClass.hpp b/castor/stager/SvcClass.hpp
index a1de2cff7ff27d4d047556457e15d9c797786cab..6267b708671a0c0dc1de3a042be6df4e05fd3a34 100644
--- a/castor/stager/SvcClass.hpp
+++ b/castor/stager/SvcClass.hpp
@@ -135,25 +135,21 @@ namespace castor {
       }
 
       /**
-       * Get the value of m_maxReplicaNb
-       * Maximum number of replicas for a file created with this service class. If 0, the
-       * replication is ruled by the replication policy. If there is none, then 0 means
-       * infinity.
-       * @return the value of m_maxReplicaNb
+       * Get the value of m_replicaNb
+       * Number of replicas for a file created with this service class
+       * @return the value of m_replicaNb
        */
-      int maxReplicaNb() const {
-        return m_maxReplicaNb;
+      int replicaNb() const {
+        return m_replicaNb;
       }
 
       /**
-       * Set the value of m_maxReplicaNb
-       * Maximum number of replicas for a file created with this service class. If 0, the
-       * replication is ruled by the replication policy. If there is none, then 0 means
-       * infinity.
-       * @param new_var the new value of m_maxReplicaNb
+       * Set the value of m_replicaNb
+       * Number of replicas for a file created with this service class
+       * @param new_var the new value of m_replicaNb
        */
-      void setMaxReplicaNb(int new_var) {
-        m_maxReplicaNb = new_var;
+      void setReplicaNb(int new_var) {
+        m_replicaNb = new_var;
       }
 
       /**
@@ -194,26 +190,6 @@ namespace castor {
         m_disk1Behavior = new_var;
       }
 
-      /**
-       * Get the value of m_replicateOnClose
-       * Flag to indicate whether files in this service class are replicated on closure.
-       * The number of copies created is defined by the maxReplicaNb attribute.
-       * @return the value of m_replicateOnClose
-       */
-      bool replicateOnClose() const {
-        return m_replicateOnClose;
-      }
-
-      /**
-       * Set the value of m_replicateOnClose
-       * Flag to indicate whether files in this service class are replicated on closure.
-       * The number of copies created is defined by the maxReplicaNb attribute.
-       * @param new_var the new value of m_replicateOnClose
-       */
-      void setReplicateOnClose(bool new_var) {
-        m_replicateOnClose = new_var;
-      }
-
       /**
        * Get the value of m_failJobsWhenNoSpace
        * Flag to indicate whether jobs that require new space on disk shall be failed
@@ -314,8 +290,8 @@ namespace castor {
       /// Default size used for space allocation in the case of a stage put with no size explicitely given (ie size given was 0).
       u_signed64 m_defaultFileSize;
 
-      /// Maximum number of replicas for a file created with this service class. If 0, the replication is ruled by the replication policy. If there is none, then 0 means infinity.
-      int m_maxReplicaNb;
+      /// Number of replicas for a file created with this service class.
+      int m_replicaNb;
 
       /// Policy ruling the behavior of the garbage collector, when enabled.
       std::string m_gcPolicy;
@@ -323,9 +299,6 @@ namespace castor {
       /// Flag to indicate whether the diskpools under this service class should behave as Disk1 pools. This means no automatic GC, and failJobsWhenNoSpace set to true.
       bool m_disk1Behavior;
 
-      /// Flag to indicate whether files in this service class are replicated on closure. The number of copies created is defined by the maxReplicaNb attribute.
-      bool m_replicateOnClose;
-
       /// Flag to indicate whether jobs that require new space on disk shall be failed when the diskpools under this service class have run out of space. This flag is enabled by default, if disabled jobs are left pending in the scheduler.
       bool m_failJobsWhenNoSpace;
 
diff --git a/hsmtools/castor_tools.py b/hsmtools/castor_tools.py
index 8b074af174ed3a867083e1f98f43a63a2cca96ca..9528d589d2ffe1182e20ca79149094ac9dee40ef 100644
--- a/hsmtools/castor_tools.py
+++ b/hsmtools/castor_tools.py
@@ -298,7 +298,6 @@ def connectToNS():
 areBooleans = ["aborted",
                "emptyfile",
                "disk1behavior",
-               "replicateonclose",
                "failJobsWhenNoSpace",
                "recursive",
                "created",
diff --git a/hsmtools/deletesvcclass.man b/hsmtools/deletesvcclass.man
index eda18e244fc488240a3e2ae93789f1b1598ddcb7..b4f35e4c8e4fef3fd761198a880b7a2af6cb25de 100644
--- a/hsmtools/deletesvcclass.man
+++ b/hsmtools/deletesvcclass.man
@@ -25,19 +25,19 @@ name of service classes to delete. Several names can be given, colon separated
 .ft CW
 
 #printsvcclass -a
-    NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE MAXREPLICANB FORCEDFILECLASS REPLICATEONCLOSE DISK1BEHAVIOR GCPOLICY RECALLERPOLICY     POOLS ID LASTEDITOR          LASTEDITION
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- default           10MiB                True            2               -            False         False  dropall              -   default 15   sponcec3 30-Aug-2011 17:10:39
-     dev           10MiB                True            1               -            False         False        -              -     extra 16   sponcec3 30-Aug-2011 17:02:05
-diskonly           10MiB                True            1            temp            False          True        -              -     extra 17   sponcec3 30-Aug-2011 17:02:10
+    NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE REPLICANB FORCEDFILECLASS DISK1BEHAVIOR GCPOLICY RECALLERPOLICY     POOLS ID LASTEDITOR          LASTEDITION
+---------------------------------------------------------------------------------------------------------------------------------------------------------
+ default           10MiB                True         2               -         False  dropall              -   default 15   sponcec3 30-Aug-2011 17:10:39
+     dev           10MiB                True         1               -         False        -              -     extra 16   sponcec3 30-Aug-2011 17:02:05
+diskonly           10MiB                True         1            temp          True        -              -     extra 17   sponcec3 30-Aug-2011 17:02:10
 
 # deletesvcclass default:dev
 successfully dropped the following service class(es) : default, dev
 
 #printsvcclass -a
-    NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE MAXREPLICANB FORCEDFILECLASS REPLICATEONCLOSE DISK1BEHAVIOR GCPOLICY RECALLERPOLICY     POOLS ID LASTEDITOR          LASTEDITION
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-diskonly           10MiB                True            1            temp            False          True        -              -     extra 17   sponcec3 30-Aug-2011 17:02:10
+    NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE REPLICANB FORCEDFILECLASS DISK1BEHAVIOR GCPOLICY RECALLERPOLICY     POOLS ID LASTEDITOR          LASTEDITION
+---------------------------------------------------------------------------------------------------------------------------------------------------------
+diskonly           10MiB                True         1            temp          True        -              -     extra 17   sponcec3 30-Aug-2011 17:02:10
 
 # deletesvcclass diskonly:dev
 successfully dropped the following service class(es) : diskonly
diff --git a/hsmtools/entersvcclass b/hsmtools/entersvcclass
index 0e7888518ad8eb8c1c2a8fd5d8c5adf1a7d39088..a0bc100b8fc144bfeda0e44ec08f905266fdd17f 100755
--- a/hsmtools/entersvcclass
+++ b/hsmtools/entersvcclass
@@ -31,29 +31,27 @@ import castor_tools
 def usage(exitCode):
     '''prints usage'''
     print 'Usage : ' + sys.argv[0] + ' [-h|--help] ' + \
-          '[--defaultfilesize <defaultFileSize>] [--maxreplicanb <maxReplicaNb>] ' + \
+          '[--defaultfilesize <defaultFileSize>] [--replicanb <ReplicaNb>] ' + \
           '[--failjobswhennospace <[yes|no]>] [--disk1behavior <[yes|no]>] ' + \
-          '[--forcedfileclass <forcedFileClass>] [--replicateonclose <[yes|no]>] ' + \
-          '--gcpolicy <gcPolicyName> ' + \
+          '[--forcedfileclass <forcedFileClass>] --gcpolicy <gcPolicyName> ' + \
           '[--pools <poolName>:[...]] <svcClassName>'
     sys.exit(exitCode)
 
 # first parse the options
 try:
     options, args = getopt.getopt(sys.argv[1:], 'hv',
-                                  ['help', 'verbose', 'defaultfilesize=', 'maxreplicanb=',
+                                  ['help', 'verbose', 'defaultfilesize=', 'replicanb=',
                                    'failjobswhennospace=', 'disk1behavior=', 'forcedfileclass=',
-                                   'replicateonclose=', 'gcpolicy=', 'pools='])
+                                   'gcpolicy=', 'pools='])
 except Exception, e:
     print e
     usage(1)
 verbose = False
 defaultfilesize = 2147483648 # 2GiB
-maxreplicanb = 1
+replicanb = 1
 failjobswhennospace = True
 disk1behavior = False
 forcedfileclass = None
-replicateonclose = False
 gcpolicy = None
 pools = []
 try:
@@ -64,16 +62,14 @@ try:
             verbose = True
         elif f == '--defaultfilesize':
             defaultfilesize = castor_tools.parseDataAmount('defaultfilesize', v)
-        elif f == '--maxreplicanb':
-            maxreplicanb = castor_tools.parsePositiveNonNullInt('maxreplicanb', v)
+        elif f == '--replicanb':
+            replicanb = castor_tools.parsePositiveNonNullInt('replicanb', v)
         elif f == '--failjobswhennospace':
             failjobswhennospace = castor_tools.parseBool('failjobswhennospace', v)
         elif f == '--disk1behavior':
             disk1behavior = castor_tools.parseBool('disk1behavior', v)
         elif f == '--forcedfileclass':
             forcedfileclass = v
-        elif f == '--replicateonclose':
-            replicateonclose = castor_tools.parseBool('replicateonclose', v)
         elif f == '--gcpolicy':
             gcpolicy = v
         elif f == '--pools':
@@ -192,11 +188,9 @@ try:
       diskPoolIds castor."cnumList" := :diskPoolIds;
       dataPoolIds castor."cnumList" := :dataPoolIds;
     BEGIN
-      INSERT INTO SvcClass (name, defaultFileSize, maxReplicaNb,
-                            gcPolicy, disk1Behavior, replicateOnClose,
+      INSERT INTO SvcClass (name, defaultFileSize, replicaNb, gcPolicy, disk1Behavior,
                             failJobsWhenNoSpace, id, forcedFileClass, lastEditor, lastEditionTime)
-             VALUES (:name, :defaultFileSize, :maxReplicaNb,
-                     :gcPolicy, :disk1Behavior, :replicateOnClose,
+             VALUES (:name, :defaultFileSize, :replicaNb, :gcPolicy, :disk1Behavior,
                      :failJobsWhenNoSpace, ids_seq.nextval, :forcedFileClass, :lastEditor, gettime())
              RETURNING id INTO scId;
       IF diskPoolIds.COUNT != 1 OR diskPoolIds(1) != -1 THEN
@@ -209,10 +203,9 @@ try:
       END IF;
     END;'''
     stcur.execute(insertFCSQL, name=svcclassname, defaultFileSize=defaultfilesize,
-                  maxReplicaNb=maxreplicanb, gcPolicy=gcpolicy, disk1Behavior=disk1behavior,
-                  replicateOnClose=replicateonclose, failJobsWhenNoSpace=failjobswhennospace,
-                  forcedFileClass=forcedfileclass, diskPoolIds=diskPoolIds, dataPoolIds=dataPoolIds,
-                  lastEditor=lasteditor)
+                  replicaNb=replicanb, gcPolicy=gcpolicy, disk1Behavior=disk1behavior,
+                  failJobsWhenNoSpace=failjobswhennospace, forcedFileClass=forcedfileclass,
+                  skPoolIds=diskPoolIds, dataPoolIds=dataPoolIds, lastEditor=lasteditor)
     # commit insertion and tell user
     stconn.commit()
     print 'inserted service class %s successfully' % svcclassname
diff --git a/hsmtools/entersvcclass.man b/hsmtools/entersvcclass.man
index ad330d454f0453b391e76696082b6b4974784f85..7ec62fe3cf32783c8692c7448f7d1ecf9070ec3d 100644
--- a/hsmtools/entersvcclass.man
+++ b/hsmtools/entersvcclass.man
@@ -11,8 +11,8 @@ entersvcclass \- define a new service class in the stager catalog
 <defaultFileSize>
 ]
 [
-.BI --maxreplicanb 
-<maxReplicaNb>
+.BI --replicanb 
+<replicaNb>
 ]
 [
 .BI --failjobswhennospace 
@@ -26,10 +26,6 @@ entersvcclass \- define a new service class in the stager catalog
 .BI --forcedfileclass 
 <forcedFileClass>
 ]
-[
-.BI --replicateonclose 
-<bool>
-]
 .BI --gcpolicy 
 <gcPolicyName>
 [
@@ -51,9 +47,8 @@ Default is 2 GiB if not specified.
 The value can be given using the standard K/M/G/T extensions, with or without B (i.e. both KB and K are accepted).
 These have the ISO meaning of powers of 10. Ki/Mi/Gi/Ti[B] extensions are also accepted and deal with powers of 2.
 .TP
-.BI \-\-maxreplicanb\ <maxReplicaNb>
-Specifies the maximum number of disk resident replicas for a given CASTOR file
-in this service class.
+.BI \-\-replicanb\ <replicaNb>
+Specifies the number of disk resident replicas for a given CASTOR file in this service class.
 Default is 1 if not specified.
 .TP
 .BI \-\-failjobswhennospace\ <boolean\ value>
@@ -74,15 +69,6 @@ specifying for this service class any TapeN retention policy, where N is the num
 tape copies of the forced file class.
 When not provided, the user specified file class is not overwritten.
 .TP
-.BI \-\-replicateonclose\ <boolean\ value>
-Enables or disables replication on close is enabled for this service class.
-When enabled, once a file is created and finalized/closed it will be replicated
-so that MaxReplicaNb copies exist in the pool where the file resides.
-Example of supported values are yes/no, y/n, true/false, t/f, 1/0.
-Note: this functionality will not rebalance the number copies in the pool in response to
-diskservers which are no longer in production!
-Default is no if not specified.
-.TP
 .BI \-\-gcpolicy\ <gcPolicyName>
 Specifies the name of the garbage collection policy to be used for this service class.
 This value is irrelevant if Disk1Behavior is set thus you can omit it in that case and "default" will then be used.
@@ -103,9 +89,9 @@ name of the service class to create.
 inserted service class public successfully
 
 #printsvcclass -a
-  NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE MAXREPLICANB FORCEDFILECLASS REPLICATEONCLOSE DISK1BEHAVIOR GCPOLICY     POOLS ID LASTEDITOR          LASTEDITION
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-public         2048MiB                True            1               -            False         False        -   default 13   sponcec3 30-Aug-2011 16:59:13
+  NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE REPLICANB FORCEDFILECLASS DISK1BEHAVIOR GCPOLICY     POOLS ID LASTEDITOR          LASTEDITION
+----------------------------------------------------------------------------------------------------------------------------------------
+public         2048MiB                True         1               -         False        -   default 13   sponcec3 30-Aug-2011 16:59:13
 
 #entersvcclass --pools default public
 SvcClass public already exists in the stager DB
diff --git a/hsmtools/modifysvcclass b/hsmtools/modifysvcclass
index 1fad2809f1dbfafb68e478583cad09c06c80ce75..be5487fdc7cd70a5d7b81cf4d7dff3e487753067 100755
--- a/hsmtools/modifysvcclass
+++ b/hsmtools/modifysvcclass
@@ -31,31 +31,28 @@ import castor_tools
 def usage(exitCode):
     '''prints usage'''
     print 'Usage : ' + sys.argv[0] + ' [-h|--help] ' + \
-          '[--defaultfilesize <defaultFileSize>] [--maxreplicanb <maxReplicaNb>] ' + \
+          '[--defaultfilesize <defaultFileSize>] [--replicanb <replicaNb>] ' + \
           '[--failjobswhennospace <[yes|no]>] [--disk1behavior <[yes|no]>] ' + \
-          '[--forcedfileclass <forcedFileClass>] [--replicateonclose <[yes|no]>] ' + \
-          '[--gcpolicy <gcPolicyName>] ' + \
+          '[--forcedfileclass <forcedFileClass>] [--gcpolicy <gcPolicyName>] ' + \
           '[--addpools <poolName>:[...]] [--removepools <poolName>:[...]] <svcClassName>'
     sys.exit(exitCode)
 
 # first parse the options
 try:
     options, args = getopt.getopt(sys.argv[1:], 'hv',
-                                  ['help', 'verbose', 'defaultfilesize=', 'maxreplicanb=',
+                                  ['help', 'verbose', 'defaultfilesize=', 'replicanb=',
                                    'failjobswhennospace=', 'disk1behavior=', 'forcedfileclass=',
-                                   'replicateonclose=', 'gcpolicy=',
-                                   'addpools=', 'removepools='])
+                                   'gcpolicy=', 'addpools=', 'removepools='])
 except Exception, e:
     print e
     usage(1)
 verbose = False
 defaultfilesize = None
-maxreplicanb = None
+replicanb = None
 failjobswhennospace = None
 disk1behavior = None
 forcedfileclass = None
 forcedfileclassset = False
-replicateonclose = None
 gcpolicy = None
 addpools = None
 removepools = None
@@ -67,8 +64,8 @@ try:
             verbose = True
         elif f == '--defaultfilesize':
             defaultfilesize = castor_tools.parseDataAmount('defaultfilesize', v)
-        elif f == '--maxreplicanb':
-            maxreplicanb = castor_tools.parsePositiveNonNullInt('maxreplicanb', v)
+        elif f == '--replicanb':
+            replicanb = castor_tools.parsePositiveNonNullInt('replicanb', v)
         elif f == '--failjobswhennospace':
             failjobswhennospace = castor_tools.parseBool('failjobswhennospace', v)
         elif f == '--disk1behavior':
@@ -76,8 +73,6 @@ try:
         elif f == '--forcedfileclass':
             forcedfileclass = v
             forcedfileclassset = True
-        elif f == '--replicateonclose':
-            replicateonclose = castor_tools.parseBool('replicateonclose', v)
         elif f == '--gcpolicy':
             gcpolicy = v
         elif f == '--addpools':
@@ -102,8 +97,8 @@ else:
     svcclassname = args[0]
 
 # check we have something to do
-if defaultfilesize == None and maxreplicanb == None and failjobswhennospace == None and \
-   disk1behavior == None and forcedfileclass == None and replicateonclose == None and gcpolicy == None and \
+if defaultfilesize == None and replicanb == None and failjobswhennospace == None and \
+   disk1behavior == None and forcedfileclass == None and gcpolicy == None and \
    addpools == None and removepools == None:
     print 'Nothing to modify. Did you forget some argument ?'
     usage(1)
@@ -125,18 +120,15 @@ try:
     if defaultfilesize != None:
         stcur.execute('UPDATE SvcClass SET defaultfilesize=:value WHERE id = :svcClassId',
                       value=defaultfilesize, svcClassId=svcClassId)
-    if maxreplicanb != None:
-        stcur.execute('UPDATE SvcClass SET maxreplicanb=:value WHERE id = :svcClassId',
-                      value=maxreplicanb, svcClassId=svcClassId)
+    if replicanb != None:
+        stcur.execute('UPDATE SvcClass SET replicanb=:value WHERE id = :svcClassId',
+                      value=replicanb, svcClassId=svcClassId)
     if failjobswhennospace != None:
         stcur.execute('UPDATE SvcClass SET failjobswhennospace=:value WHERE id = :svcClassId',
                       value=failjobswhennospace, svcClassId=svcClassId)
     if disk1behavior != None:
         stcur.execute('UPDATE SvcClass SET disk1behavior=:value WHERE id = :svcClassId',
                       value=disk1behavior, svcClassId=svcClassId)
-    if replicateonclose != None:
-        stcur.execute('UPDATE SvcClass SET replicateonclose=:value WHERE id = :svcClassId',
-                      value=replicateonclose, svcClassId=svcClassId)
     if gcpolicy != None:
         # check that the GC policyexists
         stcur.execute('SELECT name FROM GcPolicy WHERE name=:name', name=gcpolicy)
diff --git a/hsmtools/modifysvcclass.man b/hsmtools/modifysvcclass.man
index 4424cf2a550c31d92fef68c436a6feed1251bccc..4b24fbf138cc0583ba596470fc56226b1bc72177 100644
--- a/hsmtools/modifysvcclass.man
+++ b/hsmtools/modifysvcclass.man
@@ -11,8 +11,8 @@ modifysvcclass \- modifies an existing service class in the stager catalog
 <defaultFileSize>
 ]
 [
-.BI --maxreplicanb
-<maxReplicaNb>
+.BI --replicanb
+<replicaNb>
 ]
 [
 .BI --failjobswhennospace
@@ -27,10 +27,6 @@ modifysvcclass \- modifies an existing service class in the stager catalog
 <forcedFileClass>
 ]
 [
-.BI --replicateonclose
-<bool>
-]
-[
 .BI --gcpolicy
 <gcPolicyName>
 ]
@@ -57,8 +53,8 @@ If given, modifies the default file size allocation for write requests not speci
 The value can be given using the standard K/M/G/T extensions, with or without B (i.e. both KB and K are accepted).
 These have the ISO meaning of powers of 10. Ki/Mi/Gi/Ti[B] extensions are also accepted and deal with powers of 2.
 .TP
-.BI \-\-maxreplicanb <maxReplicaNb>
-If given, modifies the maximum number of disk resident replicas for a given CASTOR file
+.BI \-\-replicanb <replicaNb>
+If given, modifies the number of disk resident replicas for a given CASTOR file
 in this service class.
 .TP
 .BI \-\-failjobswhennospace <boolean value>
@@ -78,14 +74,6 @@ tape copies of the forced file class.
 In order to disable the forcing, just provide an empty class name. Do not for get the quotes
 so that the shell sees that empty argument
 .TP
-.BI \-\-replicateonclose <boolean value>
-If given, enables or disables replication on close is enabled for this service class.
-When enabled, once a file is created and finalized/closed it will be replicated
-so that MaxReplicaNb copies exist in the pool where the file resides.
-Example of supported values are yes/no, y/n, true/false, t/f, 1/0.
-Note: this functionality will not rebalance the number copies in the pool in response to
-diskservers which are no longer in production!
-.TP
 .BI \-\-gcpolicy <gcPolicyName>
 If given, modifies the name of the garbage collection policy to be used for this service class.
 This value is irrelevant if Disk1Behavior is set to yes.
@@ -105,25 +93,25 @@ name of the service class to modify.
 .nf
 .ft CW
 #printsvcclass default
-   NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE MAXREPLICANB FORCEDFILECLASS REPLICATEONCLOSE DISK1BEHAVIOR GCPOLICY     POOLS ID LASTEDITOR          LASTEDITION
--------------------------------------------------------------------------------------------------------------------------------------------------------------
-default           10MiB                True            1               -            False         False        -   default 15   sponcec3 30-Aug-2011 17:02:00
+   NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE REPLICANB FORCEDFILECLASS DISK1BEHAVIOR GCPOLICY     POOLS ID LASTEDITOR          LASTEDITION
+-----------------------------------------------------------------------------------------------------------------------------------------
+default           10MiB                True         1               -         False        -   default 15   sponcec3 30-Aug-2011 17:02:00
 
-# modifysvcclass --defaultfilesize 20GiB --maxreplicanb 2 --gcpolicy dropall --forcedfileclass temp --removepools default default
+# modifysvcclass --defaultfilesize 20GiB --replicanb 2 --gcpolicy dropall --forcedfileclass temp --removepools default default
 modified service class default successfully
 
 # printsvcclass test
-   NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE MAXREPLICANB FORCEDFILECLASS REPLICATEONCLOSE DISK1BEHAVIOR GCPOLICY     POOLS ID LASTEDITOR          LASTEDITION
--------------------------------------------------------------------------------------------------------------------------------------------------------------
-default           10MiB                True            2            temp            False         False  dropall         - 15   sponcec3 30-Aug-2011 17:09:44
+   NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE REPLICANB FORCEDFILECLASS DISK1BEHAVIOR GCPOLICY     POOLS ID LASTEDITOR          LASTEDITION
+-----------------------------------------------------------------------------------------------------------------------------------------
+default           10MiB                True         2            temp         False  dropall         - 15   sponcec3 30-Aug-2011 17:09:44
 
 # modifysvcclass --forcedfileclass '' --addpools default default
 modified service class default successfully
 
 # printsvcclass test
-   NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE MAXREPLICANB FORCEDFILECLASS REPLICATEONCLOSE DISK1BEHAVIOR GCPOLICY     POOLS ID LASTEDITOR          LASTEDITION
--------------------------------------------------------------------------------------------------------------------------------------------------------------
-default           10MiB                True            2               -            False         False  dropall   default 15   sponcec3 30-Aug-2011 17:10:39
+   NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE REPLICANB FORCEDFILECLASS DISK1BEHAVIOR GCPOLICY     POOLS ID LASTEDITOR          LASTEDITION
+-----------------------------------------------------------------------------------------------------------------------------------------
+default           10MiB                True         2               -         False  dropall   default 15   sponcec3 30-Aug-2011 17:10:39
 
 .SH NOTES
 This command requires database client access to the stager catalog and nameserver DBs.
diff --git a/hsmtools/printsvcclass b/hsmtools/printsvcclass
index f2178365fe2645611bbab49226c05cadbb558259..b7b860ca631e31e84fc29120042bb35f40439e74 100755
--- a/hsmtools/printsvcclass
+++ b/hsmtools/printsvcclass
@@ -60,8 +60,8 @@ try:
     stcur = stconn.cursor()
     sqlstatement = '''
     SELECT SvcClass.name, SvcClass.defaultfilesize, SvcClass.failjobswhennospace, SvcClass.gcPolicy,
-           SvcClass.maxReplicaNb, FileClass.name, SvcClass.replicateonclose,
-           SvcClass.disk1behavior, SvcClass.id, Pools.names, SvcClass.lastEditor, SvcClass.lastEditionTime
+           SvcClass.replicaNb, FileClass.name, SvcClass.disk1behavior, SvcClass.id,
+           Pools.names, SvcClass.lastEditor, SvcClass.lastEditionTime
       FROM SvcClass, FileClass,
            (SELECT svcClassId, cast(collect(poolName) AS strListTable) AS names
               FROM (SELECT DiskPool2SvcClass.child svcClassId, DiskPool.name poolName
@@ -85,21 +85,20 @@ try:
         unknownSvcClasses = svcClasses - existingSvcClasses
     # loop over svcclasses and print them
     if existingSvcClasses:
-        titles = ('NAME', 'DEFAULTFILESIZE', 'FAILJOBSWHENNOSPACE', 'MAXREPLICANB',
-                  'FORCEDFILECLASS', 'REPLICATEONCLOSE', 'DISK1BEHAVIOR', 'GCPOLICY',
+        titles = ('NAME', 'DEFAULTFILESIZE', 'FAILJOBSWHENNOSPACE', 'REPLICANB',
+                  'FORCEDFILECLASS', 'DISK1BEHAVIOR', 'GCPOLICY',
                   'POOLS', 'ID', 'LASTEDITOR', 'LASTEDITION')
         data = []
-        for name, defaultfilesize, failjobswhennospace, gcPolicy, maxReplicaNb, \
-                forcedFileClass, replicateonclose, disk1behavior, scId, pools, \
-                lastEditor, lastEdition in rows:
+        for name, defaultfilesize, failjobswhennospace, gcPolicy, replicaNb, \
+                forcedFileClass, disk1behavior, scId, pools, lastEditor, lastEdition in rows:
             if pools:
                 data.append((name, castor_tools.nbToDataAmount(defaultfilesize), bool(failjobswhennospace),
-                             maxReplicaNb, forcedFileClass or '-', bool(replicateonclose),
+                             replicaNb, forcedFileClass or '-',
                              bool(disk1behavior), gcPolicy, ','.join(pools),
                              scId, lastEditor, castor_tools.secsToDate(lastEdition)))
             else:
                 data.append((name, castor_tools.nbToDataAmount(defaultfilesize), bool(failjobswhennospace),
-                             maxReplicaNb, forcedFileClass or '-', bool(replicateonclose),
+                             replicaNb, forcedFileClass or '-',
                              bool(disk1behavior), gcPolicy, '-',
                              scId, lastEditor, castor_tools.secsToDate(lastEdition)))
 
diff --git a/hsmtools/printsvcclass.man b/hsmtools/printsvcclass.man
index c27ae1efe75a5f0ac818e28c3bcbc13d19895444..212d423e00ed5f76e39cf20995825857a947b7fd 100644
--- a/hsmtools/printsvcclass.man
+++ b/hsmtools/printsvcclass.man
@@ -25,16 +25,16 @@ If no service class name is given, all service class definitions are printed.
 .nf
 .ft CW
 # printsvcclass
-    NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE MAXREPLICANB FORCEDFILECLASS REPLICATEONCLOSE DISK1BEHAVIOR GCPOLICY     POOLS ID LASTEDITOR          LASTEDITION
---------------------------------------------------------------------------------------------------------------------------------------------------------------
- default           10MiB                True            1               -            False         False        -   default 15   sponcec3 30-Aug-2011 17:02:00
-     dev           10MiB                True            1               -            False         False        -     extra 16   sponcec3 30-Aug-2011 17:02:05
-diskonly           10MiB                True            1            temp            False          True        -     extra 17   sponcec3 30-Aug-2011 17:02:10
+    NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE REPLICANB FORCEDFILECLASS DISK1BEHAVIOR GCPOLICY     POOLS ID LASTEDITOR          LASTEDITION
+------------------------------------------------------------------------------------------------------------------------------------------
+ default           10MiB                True         1               -         False        -   default 15   sponcec3 30-Aug-2011 17:02:00
+     dev           10MiB                True         1               -         False        -     extra 16   sponcec3 30-Aug-2011 17:02:05
+diskonly           10MiB                True         1            temp          True        -     extra 17   sponcec3 30-Aug-2011 17:02:10
 
 # printsvcclass dev nonexisting
-NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE MAXREPLICANB FORCEDFILECLASS REPLICATEONCLOSE DISK1BEHAVIOR GCPOLICY     POOLS ID LASTEDITOR          LASTEDITION
-----------------------------------------------------------------------------------------------------------------------------------------------------------
- dev           10MiB                True            1               -            False         False        -     extra 16   sponcec3 30-Aug-2011 17:02:05
+NAME DEFAULTFILESIZE FAILJOBSWHENNOSPACE REPLICANB FORCEDFILECLASS DISK1BEHAVIOR GCPOLICY     POOLS ID LASTEDITOR          LASTEDITION
+--------------------------------------------------------------------------------------------------------------------------------------
+ dev           10MiB                True         1               -         False        -     extra 16   sponcec3 30-Aug-2011 17:02:05
 WARNING : the following service classes do not exist : nonexisting
 
 .SH NOTES
diff --git a/test/tapegateway_release_tests/schemas.txt b/test/tapegateway_release_tests/schemas.txt
index 62437c703d88a8e7f09fe58fde89b42440f8a926..eeeda17a370308e7f5bb495daf62826d7e682a0f 100644
--- a/test/tapegateway_release_tests/schemas.txt
+++ b/test/tapegateway_release_tests/schemas.txt
@@ -29,14 +29,13 @@ SQL> describe castorfile
  NBDRIVES                                           NUMBER
  NAME                                      NOT NULL VARCHAR2(2048)
  DEFAULTFILESIZE                                    NUMBER(38)
- MAXREPLICANB                                       NUMBER
+ REPLICANB                                          NUMBER
  MIGRATORPOLICY                                     VARCHAR2(2048)
  RECALLERPOLICY                                     VARCHAR2(2048)
  ID                                        NOT NULL NUMBER(38)
  STREAMPOLICY                                       VARCHAR2(2048)
  FORCEDFILECLASS                           NOT NULL NUMBER
  GCPOLICY                                           VARCHAR2(2048)
- REPLICATEONCLOSE                                   NUMBER
  DISK1BEHAVIOR                                      NUMBER
  FAILJOBSWHENNOSPACE                                NUMBER
 
diff --git a/upgrades/stager_2.1.14_to_2.1.15.sql b/upgrades/stager_2.1.14_to_2.1.15.sql
index 332fdcf9c0c6cbfc5886134a825e23073032f17f..bce9f6c9d8d5b258e8ffde8d0dddf003e01e8db9 100644
--- a/upgrades/stager_2.1.14_to_2.1.15.sql
+++ b/upgrades/stager_2.1.14_to_2.1.15.sql
@@ -127,6 +127,11 @@ CREATE INDEX I_SubRequest_Request ON SubRequest (request);
 CREATE INDEX I_SubRequest_SubReqId ON SubRequest (subReqId);
 CREATE INDEX I_SubRequest_LastModTime ON SubRequest (lastModificationTime);
 
+/* Modify SvcClass table for the drop of replicateOnClose */
+ALTER TABLE SvcClass DROP COLUMN replicateOnClose;
+ALTER TABLE SvcClass RENAME COLUMN maxReplicaNb to replicaNb;
+DROP PROCEDURE handleReplication;
+
 /* drop obsoleted entities */
 -- updates support
 DROP TABLE StagePrepareToUpdateRequest;